Skip to content

Commit 7625f0d

Browse files
authored
feat[devtools-fusebox]: support theme option (facebook#28832)
Support propagating theme from Chrome DevTools frontend, the field is optional. Next step, which is out of scope of this project and general improvement for React DevTools: teach RDT to listen to theme changes and if the theme preference is set to `auto` in settings, update the theme accordingly with the browser devtools.
1 parent 96c5846 commit 7625f0d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/react-devtools-fusebox/src/frontend.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import Bridge from 'react-devtools-shared/src/bridge';
1313
import Store from 'react-devtools-shared/src/devtools/store';
1414
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
1515

16-
import type {Wall} from 'react-devtools-shared/src/frontend/types';
16+
import type {
17+
BrowserTheme,
18+
Wall,
19+
} from 'react-devtools-shared/src/frontend/types';
1720
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
1821

1922
type Config = {
@@ -42,18 +45,20 @@ export function createStore(bridge: FrontendBridge, config?: Config): Store {
4245
type InitializationOptions = {
4346
bridge: FrontendBridge,
4447
store: Store,
48+
theme?: BrowserTheme,
4549
};
4650

4751
export function initialize(
4852
contentWindow: Element | Document,
4953
options: InitializationOptions,
5054
): void {
51-
const {bridge, store} = options;
55+
const {bridge, store, theme = 'light'} = options;
5256
const root = createRoot(contentWindow);
5357

5458
root.render(
5559
<DevTools
5660
bridge={bridge}
61+
browserTheme={theme}
5762
store={store}
5863
showTabBar={true}
5964
warnIfLegacyBackendDetected={true}

0 commit comments

Comments
 (0)