Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ scheme: Muse
# Dark Mode
darkmode: false

# Light-Dark Mode
lightdark:
enable: false
# Add @supports (color: light-dark(red, red)) check
check_supports: true


# ---------------------------------------------------------------
# Site Information Settings
Expand Down
43 changes: 43 additions & 0 deletions source/css/_colors.styl
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,46 @@ if (hexo-config('darkmode')) {
}
}
}

if (hexo-config('lightdark.enable')) {
+light-dark-block() {
:root {
--body-bg-color: light-dark($body-bg-color, $body-bg-color-dark);
--content-bg-color: light-dark($content-bg-color, $content-bg-color-dark);
--card-bg-color: light-dark($card-bg-color, $card-bg-color-dark);
--text-color: light-dark($text-color, $text-color-dark);
--selection-bg: light-dark($selection-bg, $selection-bg-dark);
--selection-color: light-dark($selection-color, $selection-color-dark);
--blockquote-color: light-dark($blockquote-color, $blockquote-color-dark);
--link-color: light-dark($link-color, $link-color-dark);
--link-hover-color: light-dark($link-hover-color, $link-hover-color-dark);
--brand-color: light-dark($brand-color, $brand-color-dark);
--brand-hover-color: light-dark($brand-hover-color, $brand-hover-color-dark);
--table-row-odd-bg-color: light-dark($table-row-odd-bg-color, $table-row-odd-bg-color-dark);
--table-row-hover-bg-color: light-dark($table-row-hover-bg-color, $table-row-hover-bg-color-dark);
--menu-item-bg-color: light-dark($menu-item-bg-color, $menu-item-bg-color-dark);
--theme-color: light-dark($theme-color, $theme-color-dark);

--btn-default-bg: light-dark($btn-default-bg, $btn-default-bg-dark);
--btn-default-color: light-dark($btn-default-color, $btn-default-color-dark);
--btn-default-border-color: light-dark($btn-default-border-color, $btn-default-border-color-dark);
--btn-default-hover-bg: light-dark($btn-default-hover-bg, $btn-default-hover-bg-dark);
--btn-default-hover-color: light-dark($btn-default-hover-color, $btn-default-hover-color-dark);
--btn-default-hover-border-color: light-dark($btn-default-hover-border-color, $btn-default-hover-border-color-dark);

color-scheme: light dark;

img {
opacity: light-dark(1, .75);

&:hover {
opacity: light-dark(1, .9);
}
}

iframe {
color-scheme: light;
}
}
}
}
13 changes: 13 additions & 0 deletions source/css/_common/components/pages/tag-cloud.styl
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,16 @@ if (hexo-config('darkmode')) {
}
}
}

if (hexo-config('lightdark.enable')) {
+light-dark-block() {
for $tag-cloud in (0 .. 10) {
$tag-cloud-color = mix($tag-cloud-end, $tag-cloud-start, $tag-cloud * 10);
$tag-cloud-color-dark = mix($tag-cloud-end-dark, $tag-cloud-start-dark, $tag-cloud * 10);
.tag-cloud-{$tag-cloud} {
border-bottom-color: light-dark($tag-cloud-color, $tag-cloud-color-dark);
color: light-dark($tag-cloud-color, $tag-cloud-color-dark);
}
}
}
}
81 changes: 45 additions & 36 deletions source/css/_common/components/third-party/disqusjs.styl
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
if (hexo-config('disqusjs.enable') and hexo-config('darkmode')) {
@media (prefers-color-scheme:dark) {
html #dsqjs a {
color: var(--link-color);
}

html #dsqjs a:focus,html #dsqjs a:hover {
color: var(--link-hover-color);
}

html #dsqjs .dsqjs-nav,html #dsqjs footer {
border-color: var(--card-bg-color);
}

html #dsqjs .dsqjs-load-more,html #dsqjs .dsqjs-load-more:hover,html #dsqjs .dsqjs-nav-tab,html #dsqjs .dsqjs-no-comment,html #dsqjs .dsqjs-post-content {
color: var(--text-color);
}

html #dsqjs .dsqjs-order-label {
background-color: #3e4b5e;
}

html #dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label {
background-color: var(--content-bg-color);
}

html #dsqjs .dsqjs-tab-active>span:after {
background-color: #2e9fff!important;
}

html #dsqjs .dsqjs-footer,html #dsqjs .dsqjs-meta {
color: var(--text-color);
}

html #dsqjs .dsqjs-post-body blockquote {
border-color: var(--content-bg-color);
if (hexo-config('disqusjs.enable')) {
html #dsqjs {
color-scheme: light;
}
if (hexo-config('darkmode')) {
@media (prefers-color-scheme:dark) {
html #dsqjs {
color-scheme: dark;
}

html #dsqjs a {
color: var(--link-color);
}

html #dsqjs a:focus,html #dsqjs a:hover {
color: var(--link-hover-color);
}

html #dsqjs .dsqjs-nav,html #dsqjs footer {
border-color: var(--card-bg-color);
}

html #dsqjs .dsqjs-load-more,html #dsqjs .dsqjs-load-more:hover,html #dsqjs .dsqjs-nav-tab,html #dsqjs .dsqjs-no-comment,html #dsqjs .dsqjs-post-content {
color: var(--text-color);
}

html #dsqjs .dsqjs-order-label {
background-color: #3e4b5e;
}

html #dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label {
background-color: var(--content-bg-color);
}

html #dsqjs .dsqjs-tab-active>span:after {
background-color: #2e9fff!important;
}

html #dsqjs .dsqjs-footer,html #dsqjs .dsqjs-meta {
color: var(--text-color);
}

html #dsqjs .dsqjs-post-body blockquote {
border-color: var(--content-bg-color);
}
}
}
}
8 changes: 8 additions & 0 deletions source/css/_common/components/third-party/gitalk.styl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ if (hexo-config('gitalk.enable')) {
}
}
}

if (hexo-config('lightdark.enable')) {
+light-dark-block() {
.gt-container .gt-header-textarea {
background-color: light-dark(#f6f6f6, var(--card-bg-color-dark)) !important;
}
}
}
}
5 changes: 5 additions & 0 deletions source/css/_common/components/third-party/search.styl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ if (hexo-config('local_search.enable') or hexo-config('algolia_search.enable'))
background: $grey-dim;
}
}
if (hexo-config('lightdark.enable')) {
+light-dark-block() {
background: light-dark($gainsboro, $grey-dim);
}
}
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: flex;
Expand Down
8 changes: 8 additions & 0 deletions source/css/_common/scaffolding/highlight/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ figure.highlight {
overflow: auto;
position: relative;

color-scheme: light;

if (hexo-config('darkmode')) {
@media (prefers-color-scheme: dark) {
color-scheme: dark;
}
}

pre {
border: 0;
margin: 0;
Expand Down
23 changes: 23 additions & 0 deletions source/css/_common/scaffolding/tags/note.styl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ if (hexo-config('note.style') != 'disabled') {
background: mix($note-bg[$type], $body-bg-color-dark, 10%);
}
}
if (hexo-config('lightdark.enable')) {
+light-dark-block() {
background: light-dark($note-bg[$type], mix($note-bg[$type], $body-bg-color-dark, 10%));
}
}
}

if ($note-style == 'modern') {
Expand Down Expand Up @@ -103,6 +108,24 @@ if (hexo-config('note.style') != 'disabled') {
}
}
}

if (hexo-config('lightdark.enable')) {
+light-dark-block() {
background: light-dark($note-modern-bg[$type], $note-modern-bg-dark[$type]);
border-color: light-dark($note-modern-border[$type], $note-modern-border-dark[$type]);
color: light-dark($note-modern-text[$type], $note-modern-text-dark[$type]);

a:not(.btn) {
border-bottom-color: light-dark($note-modern-text[$type], $note-modern-text-dark[$type]);
color: light-dark($note-modern-text[$type], $note-modern-text-dark[$type]);

&:hover {
border-bottom-color: light-dark($note-modern-hover[$type], $note-modern-hover-dark[$type]);
color: light-dark($note-modern-hover[$type], $note-modern-hover-dark[$type]);
}
}
}
}
}

if ($note-style != 'modern') {
Expand Down
11 changes: 11 additions & 0 deletions source/css/_mixins.styl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ desktop-largest() {
}
}

light-dark-block() {
if (hexo-config('lightdark.check_supports')){
@supports (color: light-dark(red, red)) {
{block};
}
}
else {
{block};
}
}

sidebar() {
if (($scheme == 'Muse') or ($scheme == 'Mist')) {
{block}
Expand Down