We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32a55ca commit ef78eeeCopy full SHA for ef78eee
packages/browser/src/global/media.ts
@@ -2,7 +2,10 @@
2
* Get the current color scheme of the user.
3
*/
4
export function getColorScheme() {
5
- return window.matchMedia("(prefers-color-scheme: dark)").matches
+ const { colorScheme } = window.getComputedStyle(document.body);
6
+ return colorScheme === "dark" ||
7
+ colorScheme === "dark only" ||
8
+ window.matchMedia("(prefers-color-scheme: dark)").matches
9
? "dark"
10
: "light";
11
}
packages/storybook/stories/button.css
@@ -1,12 +1,14 @@
1
:root {
--button-bg: #1ea7fd;
--button-text: #fff;
+ color-scheme: light;
.dark {
--button-bg: #fff;
--button-text: #333;
background: #000;
+ color-scheme: dark;
12
13
14
.storybook-button {
0 commit comments