diff --git a/packages/styles/index.html b/packages/styles/index.html index 53ef398d94..40d3a5919e 100644 --- a/packages/styles/index.html +++ b/packages/styles/index.html @@ -1,10 +1,10 @@ - + Styles playground - + @@ -17,20 +17,49 @@

Styles package playground

> to get going.

- +
- +
+ I am light. +
+

+ I use a specific color from the palette (it might be the same as the body color). +

+

I use the main body color.

+
+
+

+ I use a specific color from the palette (it might be the same as the body color). +

+

I use the main body color.

+
+
+
+ I am supposed to be dark. +
+

+ I use a specific color from the palette (it might be the same as the body color). +

+

I use the main body color.

+
+
+

+ I use a specific color from the palette (it might be the same as the body color). +

+

I use the main body color.

+
+
diff --git a/packages/styles/src/palettes/_mixins.scss b/packages/styles/src/palettes/_mixins.scss index d765c2b5d9..7890e5e20a 100644 --- a/packages/styles/src/palettes/_mixins.scss +++ b/packages/styles/src/palettes/_mixins.scss @@ -12,19 +12,16 @@ @mixin generate-palette-class($name, $theme) { .palette-#{$name} { - &, - &:is([data-color-scheme='light'], [data-color-scheme='light'] *) { - @include palette-styles($name, $theme, 'light', $redefine-tokens: true); - } + @include palette-styles($name, $theme, 'light', $redefine-tokens: true); - &:is([data-color-scheme='dark'], [data-color-scheme='dark'] *) { + [data-color-scheme='dark'] & { @include palette-styles($name, $theme, 'dark', $redefine-tokens: true); } } } @mixin default-palette-styles($theme) { - &:not([data-color-scheme='dark']) { + & { @include palette-styles($default-palette, $theme, 'light'); } @@ -37,14 +34,9 @@ $palette: map.get(meta.module-variables(palettes), '#{$theme}-#{$scheme}'); @if ($palette) { - --post-palette-fg: #{tokens.get('palettes-color-#{$name}-fg', palettes.$post-palettes)}; - --post-palette-bg: #{tokens.get('palettes-color-#{$name}-bg', palettes.$post-palettes)}; - background-color: var(--post-palette-bg) !important; + background-color: tokens.get('palettes-color-#{$name}-bg', palettes.$post-palettes) !important; @if ($redefine-tokens == true) { - // redefining the body color is required so that the new color scheme is taken into account - color: tokens.get('body-color', elements.$post-body); - $bg-scheme: tokens.get('helper-color-#{$name}-bg-scheme', $palette); @if ($bg-scheme == 'light') { @extend %color-scheme-light;