mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 20:19:13 +00:00
@@ -91,11 +91,6 @@ const colorScheme = new ThemeAspect({
|
||||
domChange(() => {
|
||||
let dark = this.computedValue === 'dark';
|
||||
document.documentElement.classList.toggle(`wa-dark`, dark);
|
||||
|
||||
for (let el of document.querySelectorAll('.wa-invert')) {
|
||||
el.classList.toggle('wa-dark', !dark);
|
||||
el.classList.toggle('wa-light', dark);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
4
docs/docs/themes/creating.md
vendored
4
docs/docs/themes/creating.md
vendored
@@ -21,7 +21,8 @@ If you're customizing the default light styles, scope your styles to the followi
|
||||
:where(:root),
|
||||
:host,
|
||||
.wa-theme-default,
|
||||
.wa-light {
|
||||
.wa-light,
|
||||
.wa-dark .wa-invert {
|
||||
/* your custom styles here */
|
||||
}
|
||||
```
|
||||
@@ -30,6 +31,7 @@ If you're customizing the default dark styles, scope your styles to the followin
|
||||
|
||||
```css
|
||||
.wa-dark,
|
||||
.wa-invert,
|
||||
:is(:host-context(.wa-dark)) {
|
||||
/* your custom styles here */
|
||||
}
|
||||
|
||||
5
docs/docs/themes/index.njk
vendored
5
docs/docs/themes/index.njk
vendored
@@ -22,6 +22,7 @@ Please note that if you import multiple themes, the last one will be the default
|
||||
|
||||
Each theme may also include both light and dark color schemes with the classes `wa-light` and `wa-dark`.
|
||||
You can use these classes to apply a specific color scheme to an entire page or just a section.
|
||||
You can also use `wa-invert` which behaves like `wa-dark` in light mode, and like `wa-light` in dark mode.
|
||||
In pre-made themes, we use a light color scheme by default.
|
||||
|
||||
|
||||
@@ -36,11 +37,13 @@ For example, the default theme is set up like this:
|
||||
:where(:root),
|
||||
:host,
|
||||
.wa-theme-default,
|
||||
.wa-light {
|
||||
.wa-light,
|
||||
.wa-dark .wa-invert {
|
||||
/* all CSS custom properties for color, typography, space, etc. */
|
||||
}
|
||||
|
||||
.wa-dark,
|
||||
.wa-invert,
|
||||
:host-context(.wa-dark) {
|
||||
/* subset of CSS custom properties for a dark color scheme */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user