diff --git a/browser.js b/browser.js index f907c708..a2552839 100644 --- a/browser.js +++ b/browser.js @@ -37,6 +37,13 @@ exports.colors = [ */ function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && 'process' in window && window.process.type === 'renderer') { + return true; + } + // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||