added support for color scheme user preference

This commit is contained in:
Gabriele Musco 2021-12-25 00:08:51 +01:00
parent a9b0deb581
commit 0a0ff640a2
No known key found for this signature in database
GPG Key ID: 0587A5D65B5DC99E
2 changed files with 28 additions and 1 deletions

View File

@ -58,6 +58,33 @@ $light_sidebar_fg: {{ $colors.light.sidebar.fg | default "#121211" }};
{{ end }} {{ end }}
} }
{{ if ($colors.auto_switch | default false) }}
@media (prefers-color-scheme: dark) {
:root {
--default_bg: #{$dark_bg};
--default_hl_bg: #{$dark_hl_bg};
--default_fg: #{$dark_fg};
--default_dim_fg: #{$dark_dim_fg};
--default_stroke: #{$dark_stroke};
--default_accent: #{$dark_accent};
--default_sidebar_bg: #{$dark_sidebar_bg};
--default_sidebar_fg: #{$dark_sidebar_fg};
}
}
@media (prefers-color-scheme: light) {
:root {
--default_bg: #{$light_bg};
--default_hl_bg: #{$light_hl_bg};
--default_fg: #{$light_fg};
--default_dim_fg: #{$light_dim_fg};
--default_stroke: #{$light_stroke};
--default_accent: #{$light_accent};
--default_sidebar_bg: #{$light_sidebar_bg};
--default_sidebar_fg: #{$light_sidebar_fg};
}
}
{{ end }}
$main_font: {{ .Site.Params.fontFamily | default "JetBrains Mono" }}; $main_font: {{ .Site.Params.fontFamily | default "JetBrains Mono" }};
$title_font: {{ .Site.Params.titleFontFamily | default "$main_font" }}; $title_font: {{ .Site.Params.titleFontFamily | default "$main_font" }};

View File

@ -1,5 +1,5 @@
default: dark # light default: dark # light
auto_switch: false auto_switch: false # set to true to respect the user preference
dark: dark:
bg: '#242629' # main site background bg: '#242629' # main site background
hl_bg: '#34363b' # card and circle navigation background color for discrete card mode hl_bg: '#34363b' # card and circle navigation background color for discrete card mode