mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
chore(examples): extract Theme component and persist to localStorage
This commit is contained in:
parent
67c01e9148
commit
f9b2f69966
3 changed files with 64 additions and 3 deletions
|
@ -8,6 +8,19 @@
|
|||
import Notification20 from "carbon-icons-svelte/lib/Notification20";
|
||||
import UserAvatar20 from "carbon-icons-svelte/lib/UserAvatar20";
|
||||
import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const ctx = getContext("Theme");
|
||||
|
||||
$: if (ctx) {
|
||||
ctx.dark.subscribe((value) => {
|
||||
console.log("dark mode?", value);
|
||||
});
|
||||
ctx.light.subscribe((value) => {
|
||||
console.log("light mode?", value);
|
||||
});
|
||||
ctx.updateVar("--cds-productive-heading-06-font-size", "4rem");
|
||||
}
|
||||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Components Svelte" href="/">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue