diff --git a/_config.yml b/_config.yml index cc24d3a..f10ec2a 100644 --- a/_config.yml +++ b/_config.yml @@ -342,8 +342,10 @@ text_align: # Reduce padding / margin indents on devices with narrow width. mobile_layout_economy: false -# Android Chrome header panel color ($brand-bg / $headband-bg => $black-deep). -android_chrome_color: "#222" +# Browser header panel color. +theme_color: + light: "#222" + dark: "#222" # Override browsers' default behavior. body_scrollbar: diff --git a/layout/_partials/head/head.njk b/layout/_partials/head/head.njk index 5f730d4..1dad674 100644 --- a/layout/_partials/head/head.njk +++ b/layout/_partials/head/head.njk @@ -1,6 +1,11 @@ - +{%- if theme.darkmode %} + + +{%- else %} + +{%- endif %} {{ next_pre() }} @@ -15,7 +20,7 @@ {%- endif %} {%- if theme.favicon.safari_pinned_tab %} - + {%- endif %} {%- if theme.favicon.android_manifest %} diff --git a/source/css/_colors.styl b/source/css/_colors.styl index 0b561c4..3f05eab 100644 --- a/source/css/_colors.styl +++ b/source/css/_colors.styl @@ -11,6 +11,7 @@ --table-row-odd-bg-color: $table-row-odd-bg-color; --table-row-hover-bg-color: $table-row-hover-bg-color; --menu-item-bg-color: $menu-item-bg-color; + --theme-color: $theme-color; --btn-default-bg: $btn-default-bg; --btn-default-color: $btn-default-color; @@ -40,6 +41,7 @@ if (hexo-config('darkmode')) { --table-row-odd-bg-color: $table-row-odd-bg-color-dark; --table-row-hover-bg-color: $table-row-hover-bg-color-dark; --menu-item-bg-color: $menu-item-bg-color-dark; + --theme-color: $theme-color-dark; --btn-default-bg: $btn-default-bg-dark; --btn-default-color: $btn-default-color-dark; diff --git a/source/css/_common/components/reading-progress.styl b/source/css/_common/components/reading-progress.styl index f0c5aa4..d28c4f9 100644 --- a/source/css/_common/components/reading-progress.styl +++ b/source/css/_common/components/reading-progress.styl @@ -1,8 +1,8 @@ if (hexo-config('reading_progress.enable')) { .reading-progress-bar { --progress: 0; - background: unquote(hexo-config('reading_progress.color')); - height: unquote(hexo-config('reading_progress.height')); + background: convert(hexo-config('reading_progress.color')); + height: convert(hexo-config('reading_progress.height')); position: fixed; z-index: $zindex-5; diff --git a/source/css/_common/outline/footer/index.styl b/source/css/_common/outline/footer/index.styl index 75cd08c..52e5a05 100644 --- a/source/css/_common/outline/footer/index.styl +++ b/source/css/_common/outline/footer/index.styl @@ -66,7 +66,7 @@ } .with-love { - color: unquote(hexo-config('footer.icon.color')); + color: convert(hexo-config('footer.icon.color')); display: inline-block; margin: 0 5px; diff --git a/source/css/_common/outline/header/bookmark.styl b/source/css/_common/outline/header/bookmark.styl index d76411d..f0f01d3 100644 --- a/source/css/_common/outline/header/bookmark.styl +++ b/source/css/_common/outline/header/bookmark.styl @@ -11,7 +11,7 @@ if (hexo-config('bookmark.enable')) { } &::before { - color: unquote(hexo-config('bookmark.color')); + color: convert(hexo-config('bookmark.color')); font-size: 32px; line-height: 1; font-family-icons('\f02e'); diff --git a/source/css/_common/outline/header/github-banner.styl b/source/css/_common/outline/header/github-banner.styl index c41a93c..214f768 100644 --- a/source/css/_common/outline/header/github-banner.styl +++ b/source/css/_common/outline/header/github-banner.styl @@ -14,15 +14,13 @@ if (hexo-config('github_banner.enable')) { } .github-corner { - $bg-color = unquote(hexo-config('android_chrome_color')); - :hover .octo-arm { animation: octocat-wave 560ms ease-in-out; } svg { color: white; - fill: $bg-color; + fill: var(--theme-color); position: absolute; right: 0; top: 0; @@ -36,7 +34,7 @@ if (hexo-config('github_banner.enable')) { svg { if (($scheme == 'Pisces') or ($scheme == 'Gemini')) { - color: $bg-color; + color: var(--theme-color); fill: white; } } diff --git a/source/css/_common/scaffolding/tags/pdf.styl b/source/css/_common/scaffolding/tags/pdf.styl index 718906f..6881622 100644 --- a/source/css/_common/scaffolding/tags/pdf.styl +++ b/source/css/_common/scaffolding/tags/pdf.styl @@ -1,7 +1,7 @@ if (hexo-config('pdf.enable')) { .pdfobject-container { iframe, embed { - height: unquote(hexo-config('pdf.height')); + height: convert(hexo-config('pdf.height')); width: 100%; } } diff --git a/source/css/_schemes/Pisces/_header.styl b/source/css/_schemes/Pisces/_header.styl index 0616274..8fca672 100644 --- a/source/css/_schemes/Pisces/_header.styl +++ b/source/css/_schemes/Pisces/_header.styl @@ -1,5 +1,5 @@ .site-brand-container { - background: $black-deep; + background: var(--theme-color); .site-nav-on & { +tablet-mobile() { diff --git a/source/css/_variables/base.styl b/source/css/_variables/base.styl index 9a58edd..48035ec 100644 --- a/source/css/_variables/base.styl +++ b/source/css/_variables/base.styl @@ -66,6 +66,9 @@ $card-bg-color-dark = $black-light; $menu-item-bg-color = $whitesmoke; $menu-item-bg-color-dark = $black-light; +$theme-color = convert(hexo-config('theme_color.light')); +$theme-color-dark = convert(hexo-config('theme_color.dark')); + // Typography // Font, line-height, and elements colors. // -------------------------------------------------- @@ -198,7 +201,7 @@ $content-mobile-padding = 8px; // Headband // -------------------------------------------------- $headband-height = 3px; -$headband-bg = $black-deep; +$headband-bg = var(--theme-color); // Section Header