mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 03:01:25 +00:00
style(docs): color-scheme
reflects theme (#1874)
This commit is contained in:
parent
fe0b0c2b18
commit
1600775968
4 changed files with 34 additions and 7 deletions
|
@ -5,6 +5,16 @@
|
|||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Carbon Components Svelte</title>
|
||||
<script>
|
||||
try {
|
||||
const theme = localStorage.getItem("theme");
|
||||
|
||||
if (["white", "g10", "g80", "g90", "g100"].includes(theme)) {
|
||||
document.documentElement.setAttribute("theme", theme);
|
||||
document.documentElement.style.setProperty("color-scheme", ["white", "g10"].includes(theme) ? "light" : "dark");
|
||||
}
|
||||
} catch (e) {}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" src="/src/index.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue