diff options
author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-06-18 14:00:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 18:00:52 +0000 |
commit | ebd911201df0e6fce95b408935fb35580851170e (patch) | |
tree | 1955088b5c5157a02b1d75d8994e20114199830c /ext/css | |
parent | 129be78c9bf1b9d378050c6ca6ec722ef456c4ee (diff) |
Add full dark mode support (#1079)
* Add full dark mode support
* Fix welcome, permissions, and quick start scrollbars
* Fix action popup dark mode on mobile
* Add theme to info page
* Reduce flashbang
* Move position of settingsDisplayController to not break things
* Fix dictionary import drag drop theming
* Make dark shadow color less bad
* Prepare themeController to avoid not being able to set browser theme
Diffstat (limited to 'ext/css')
-rw-r--r-- | ext/css/action-popup.css | 63 | ||||
-rw-r--r-- | ext/css/material.css | 2 | ||||
-rw-r--r-- | ext/css/popup-preview.css | 11 | ||||
-rw-r--r-- | ext/css/settings.css | 47 |
4 files changed, 97 insertions, 26 deletions
diff --git a/ext/css/action-popup.css b/ext/css/action-popup.css index e88aa3ee..5b68396f 100644 --- a/ext/css/action-popup.css +++ b/ext/css/action-popup.css @@ -27,6 +27,30 @@ --warning-color: #96751c; --warning-color-light: #edc75e; + + --nav-button-background-image: linear-gradient(#f8f8f8, #e0e0e0); + --nav-button-border-color: #cccccc; + --nav-button-background-image-focus: linear-gradient(#e8e8e8, #d0d0d0); + --nav-button-border-color-focus: #aaaaaa; + --nav-button-background-image-active-focus: linear-gradient(#c8c8c8, #e0e0e0); + --nav-button-border-color-active-focus: #808080; + --nav-button-icon-bg: #333333; + --background-color: #f8f9fa; + --text-color: #333333; + --svg-filter: 0; +} + +:root[data-theme=dark] { + --nav-button-background-image: linear-gradient(#464646, #444444); + --nav-button-border-color: #333333; + --nav-button-background-image-focus: linear-gradient(#171717, #2f2f2f); + --nav-button-border-color-focus: #555555; + --nav-button-background-image-active-focus: linear-gradient(#373737, #1f1f1f); + --nav-button-border-color-active-focus: #7f7f7f; + --nav-button-icon-bg: #fbfbfb; + --background-color: #1e1e1e; + --text-color: #cccccc; + --svg-filter: invert(100%); } body { @@ -36,6 +60,7 @@ body { font-size: var(--font-size); width: max-content; height: max-content; + background-color: var(--background-color); } h3 { @@ -44,7 +69,7 @@ h3 { font-weight: 500; line-height: 1.1; font-size: 24px; - color: inherit; + color: var(--text-color); } label { font-weight: normal; @@ -98,7 +123,7 @@ label { margin: 0 -10px; padding: 0.5em 10px; cursor: pointer; - color: #333; + color: var(--text-color); text-decoration: none; background-color: transparent; transition: background-color 0.125s linear 0s; @@ -109,7 +134,7 @@ label { } .link-group:hover, .link-group:active { - color: #333; + color: var(--text-color); text-decoration: none; } .link-group:hover>.link-group-label, @@ -136,11 +161,11 @@ label { margin: 0; padding: 0; } -.link-group-icon[data-icon=chevron] { background-image: url(/images/right-chevron.svg); } -.link-group-icon[data-icon=cog] { background-image: url(/images/cog.svg); } -.link-group-icon[data-icon=key] { background-image: url(/images/key.svg); } -.link-group-icon[data-icon=magnifying-glass] { background-image: url(/images/magnifying-glass.svg); } -.link-group-icon[data-icon=question-mark-circle] { background-image: url(/images/question-mark-circle.svg); } +.link-group-icon[data-icon=chevron] { background-image: url(/images/right-chevron.svg); filter: var(--svg-filter); } +.link-group-icon[data-icon=cog] { background-image: url(/images/cog.svg); filter: var(--svg-filter); } +.link-group-icon[data-icon=key] { background-image: url(/images/key.svg); filter: var(--svg-filter); } +.link-group-icon[data-icon=magnifying-glass] { background-image: url(/images/magnifying-glass.svg); filter: var(--svg-filter); } +.link-group-icon[data-icon=question-mark-circle] { background-image: url(/images/question-mark-circle.svg); filter: var(--svg-filter); } .link-group-label { vertical-align: middle; @@ -304,8 +329,8 @@ input[type=checkbox]~.toggle-group>.toggle-handle:active:focus { white-space: nowrap; } .nav-button { - background-image: linear-gradient(#f8f8f8, #e0e0e0); - border: 1px solid #cccccc; + background-image: var(--nav-button-background-image); + border: 1px solid var(--nav-button-border-color); margin: 0; padding: 2px 3px; cursor: pointer; @@ -317,27 +342,27 @@ input[type=checkbox]~.toggle-group>.toggle-handle:active:focus { .nav-button:hover, .nav-button:focus { z-index: 1; - border-color: #aaaaaa; - background-image: linear-gradient(#e8e8e8, #d0d0d0); + border-color: var(--nav-button-border-color-focus); + background-image: var(--nav-button-background-image-focus); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); outline: none; } .nav-button:focus:not(:focus-visible) { - background-image: linear-gradient(#f8f8f8, #e0e0e0); - border-color: #cccccc; + background-image: var(--nav-button-background-image); + border-color: var(--nav-button-border-color); box-shadow: none; } .nav-button:focus-visible { z-index: 1; - border-color: #aaaaaa; - background-image: linear-gradient(#e8e8e8, #d0d0d0); + border-color: var(--nav-button-border-color-focus); + background-image: var(--nav-button-background-image-focus); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); } .nav-button:active, .nav-button:active:focus { z-index: 1; - border-color: #808080; - background-image: linear-gradient(#c8c8c8, #e0e0e0); + border-color: var(--nav-button-border-color-active-focus); + background-image: var(--nav-button-background-image-active-focus); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); } .nav-button>.icon { @@ -346,7 +371,7 @@ input[type=checkbox]~.toggle-group>.toggle-handle:active:focus { width: 16px; height: 16px; box-sizing: content-box; - background-color: #333333; + background-color: var(--nav-button-icon-bg); } .nav-button:first-child, .nav-button:first-child[hidden]+.nav-button { diff --git a/ext/css/material.css b/ext/css/material.css index 18c72621..00265586 100644 --- a/ext/css/material.css +++ b/ext/css/material.css @@ -136,7 +136,7 @@ --background-color-light: #0a0a0a; --background-color-dark1: #333333; - --shadow-color: rgba(255, 255, 255, 0.185); + --shadow-color: rgba(105, 105, 105, 0.185); --shadow-color-off: rgba(255, 255, 255, 0); --shadow-color-light: rgba(255, 255, 255, 0.085); diff --git a/ext/css/popup-preview.css b/ext/css/popup-preview.css index 2f5a03a8..a72edc65 100644 --- a/ext/css/popup-preview.css +++ b/ext/css/popup-preview.css @@ -24,18 +24,23 @@ --line-height: calc(var(--line-height-no-units) / var(--font-size-no-units)); --animation-duration: 0s; + + --example-text-color: #333333; } :root[data-loaded=true] { --animation-duration: 0.25s; } +:root[data-theme=dark] { + --example-text-color: #d4d4d4; +} + + html { transition: background-color var(--animation-duration) linear 0s, color var(--animation-duration) linear 0s; background-color: rgba(255, 255, 255, 0); - color: #333333; } html.dark { - color: #d4d4d4; background-color: #1e1e1e; } html, @@ -92,7 +97,7 @@ body { margin: 0; padding: 0; outline: none; - color: inherit; + color: var(--example-text-color); background-color: transparent; white-space: pre; transition: background-color var(--animation-duration) linear 0s, border-color var(--animation-duration) linear 0s; diff --git a/ext/css/settings.css b/ext/css/settings.css index d23062b1..3c05906e 100644 --- a/ext/css/settings.css +++ b/ext/css/settings.css @@ -76,6 +76,15 @@ --modal-padding-vertical: 0.625em; --modal-padding-vertical-half: calc(var(--modal-padding-vertical) * 0.5); --modal-button-spacing: 0.625em; + + --scrollbar-thumb-color: #c1c1c1; + --scrollbar-track-color: #f1f1f1; + --scrollbar-inverse-thumb-color: #444444; + --scrollbar-inverse-track-color: #2f2f2f; + + --dictionary-import-border-color: #cccccc; + --dictionary-import-border-color-hover: #bfd1ff; + --dictionary-import-hover-background-color: rgba(28, 116, 233, 0.05); } :root:not([data-loaded=true]) { --animation-duration: 0s; @@ -83,6 +92,38 @@ :root[data-theme=dark] { --separator-color1: #333333; --separator-color2: #222222; + + --scrollbar-thumb-color: #444444; + --scrollbar-track-color: #2f2f2f; + --scrollbar-inverse-thumb-color: #c1c1c1; + --scrollbar-inverse-track-color: #f1f1f1; + + --dictionary-import-border-color: #333333; + --dictionary-import-border-color-hover: #1c74e9; + --dictionary-import-hover-background-color: rgba(191, 209, 255, 0.05); +} + +/* Scrollbars */ +:root:not([data-theme=light]) .scrollbar { + scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color); +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar { + width: auto; +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar-button { + height: 0; +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar-thumb { + background-color: var(--scrollbar-thumb-color); +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar-track { + background-color: var(--scrollbar-thumb-color); +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar-track-piece { + background-color: var(--scrollbar-track-color); +} +:root:not([data-theme=light]) .scrollbar::-webkit-scrollbar-corner { + background-color: var(--scrollbar-track-color); } @@ -2377,7 +2418,7 @@ input[type=number].dictionary-priority { #dictionary-drop-file-zone { transition: background-color var(--animation-duration) ease-in-out, border var(--animation-duration) ease-in-out; - border: 2px dashed rgb(204, 204, 204); + border: 2px dashed var(--dictionary-import-border-color); border-radius: 5px; flex: auto; min-height: 20em; @@ -2390,13 +2431,13 @@ input[type=number].dictionary-priority { } #dictionary-drop-file-zone:hover { - background-color: rgba(28, 116, 233, 0.05); + background-color: var(--dictionary-import-hover-background-color); border: 2px dashed var(--accent-color); } #dictionary-drop-file-zone.drag-over { border: 2px solid var(--accent-color); - background-color: rgb(191, 209, 255); + background-color: var(--dictionary-import-border-color-hover); } #dictionary-drag-drop-text { |