-
Notifications
You must be signed in to change notification settings - Fork 374
VUFIND-1590: Add dark mode color-scheme #4472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 1 commit
3c5a45b
9fa29d2
cc47f67
3f10590
a25e771
77ee726
e1a7c65
23b9a4d
83884ef
d5d7ec6
d6d50b7
c422c12
396335a
e27762f
27e4e42
c8c342a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -654,6 +654,11 @@ header .container.navbar { margin-bottom: 0; } | |
| height: auto !important; | ||
| } | ||
| } | ||
| @include color-mode(dark, true) { | ||
| .top-title { | ||
| color: #fff; | ||
| } | ||
| } | ||
|
Comment on lines
+645
to
+649
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be an example of overriding a locally defined color, in this case for It would be more elegant IMHO to put this |
||
|
|
||
| /* ------ CURRENT FILTERS ------ */ | ||
| .active-filters { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* Override of built-in color mode, to output both types */ | ||
|
|
||
| @mixin color-mode($mode: light, $root: false) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am overriding the provided color-mode mixin, which supports only one mode at a time -- either system-defined or DOM-defined color-scheme, but not both. So, I'm outputting the CSS for both types. |
||
| // Generally ignore $color-mode-type and output handlers for both types. | ||
| // Handle media-query $color-mode-type | ||
| @if $root == true { | ||
| @media (prefers-color-scheme: $mode) { | ||
| :root:not([data-bs-theme]) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
| @content; | ||
| } | ||
| } | ||
| } @else { | ||
| // Except that for non-root elements, only output the media-query for its own type | ||
| // And don't use non-root media queries for our customized dark theme | ||
| @if $color-mode-type == "media-query" { | ||
| @media (prefers-color-scheme: $mode) { | ||
| @content; | ||
| } | ||
| } | ||
| } | ||
| // And handle data $color-mode-type | ||
| [data-bs-theme="#{$mode}"] { | ||
| @content; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Import vendor override mixins here | ||
|
|
||
| @import 'color-mode'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,20 @@ $nav-link-hover-bg: $gray-lighter !default; | |
|
|
||
| $alert-default-bg: #f5f5f5 !default; | ||
| $alert-default-border-color: darken($alert-default-bg, 7%) !default; | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These styles in variables.scss replace the global (not color-scheme specific) declarations in bootstrap-variable-overrides.scss. |
||
| @include color-mode(light, true) { | ||
| .breadcrumb { | ||
| --bs-breadcrumb-bg: #f5f5f5; | ||
| } | ||
| } | ||
| @include color-mode(dark, true) { | ||
| .breadcrumb { | ||
| --bs-breadcrumb-bg: #{$dark-bg-subtle-dark}; | ||
| } | ||
| } | ||
|
|
||
| @include color-mode(light, true) { | ||
| table.table-striped { | ||
| --bs-table-striped-bg: #f9f9f9; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,9 @@ | |
| $this->layout()->searchbox = $this->context($this)->renderInContext('search/searchbox.phtml', []); | ||
| } | ||
| ?> | ||
| <html lang="<?=$this->layout()->userLang?>"<?php if ($this->layout()->rtl): ?> dir="rtl"<?php endif; ?>> | ||
| <html | ||
| <?php /* data-bs-theme="dark" */ ?> | ||
|
||
| lang="<?=$this->layout()->userLang?>"<?php if ($this->layout()->rtl): ?> dir="rtl"<?php endif; ?>> | ||
| <head> | ||
| <?php $this->setupThemeResources(); ?> | ||
| <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
|
|
||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, we would have to not define any colors using these bootstrap global properties, as these are not specific to any color mode.