Expose dark mode flag to plugin authors

Summary:
Should be available now with
```
getFlipperLib().settings().isDarkMode
```

Differential Revision: D46685851

fbshipit-source-id: 0777437b7ca06051cc3fd4dc1b794242f453f2b5
This commit is contained in:
Andrey Goncharov
2023-06-13 08:18:14 -07:00
committed by Facebook GitHub Bot
parent bf2f1283d3
commit 84e481e7e9
6 changed files with 24 additions and 1 deletions

View File

@@ -59,5 +59,16 @@ export function initializeFlipperLibImplementation(
);
},
DetailsSidebarImplementation: DetailSidebarImpl,
settings() {
const darkModeState = store.getState().settingsState.darkMode;
let isDarkMode = darkModeState === 'dark';
if (
darkModeState === 'system' &&
window.matchMedia('(prefers-color-scheme:dark)').matches
) {
isDarkMode = true;
}
return {isDarkMode};
},
});
}