diff --git a/qt/aqt/data/web/css/webview.scss b/qt/aqt/data/web/css/webview.scss index 42bb5dd56..949f16bb2 100644 --- a/qt/aqt/data/web/css/webview.scss +++ b/qt/aqt/data/web/css/webview.scss @@ -2,7 +2,8 @@ * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ @use 'ts/sass/core'; -@use 'buttons'; +@use 'ts/sass/scrollbar'; +@use 'ts/sass/buttons'; // core.scss sets border-box, but we need to // keep the old behaviour for now to avoid breaking @@ -20,29 +21,6 @@ h1 { margin-bottom: 0.2em; } -body.nightMode { - &::-webkit-scrollbar { - background: var(--window-bg); - - &:horizontal { - height: 12px; - } - - &:vertical { - width: 12px; - } - } - - &::-webkit-scrollbar-thumb { - background: buttons.$fusion-button-hover-bg; - border-radius: 8px; - - &:horizontal { - min-width: 50px; - } - - &:vertical { - min-height: 50px; - } - } +.nightMode { + @include scrollbar.night-mode; } diff --git a/ts/editor/editable.scss b/ts/editor/editable.scss index 5d0d45cda..9cd7186f3 100644 --- a/ts/editor/editable.scss +++ b/ts/editor/editable.scss @@ -1,3 +1,5 @@ +@use 'ts/sass/scrollbar'; + anki-editable { display: block; overflow-wrap: break-word; @@ -8,16 +10,20 @@ anki-editable { content: "\a"; white-space: pre; } -} -img { - max-width: 100%; - - &.drawing { - zoom: 50%; - - .nightMode & { - filter: unquote("invert() hue-rotate(180deg)"); - } + * { + max-width: 100%; + } +} + +:host-context(.nightMode) * { + @include scrollbar.night-mode; +} + +img.drawing { + zoom: 50%; + + .nightMode & { + filter: unquote("invert() hue-rotate(180deg)"); } } diff --git a/qt/aqt/data/web/css/_buttons.scss b/ts/sass/_buttons.scss similarity index 99% rename from qt/aqt/data/web/css/_buttons.scss rename to ts/sass/_buttons.scss index 70b1288d4..7a6556b38 100644 --- a/qt/aqt/data/web/css/_buttons.scss +++ b/ts/sass/_buttons.scss @@ -66,4 +66,4 @@ $fusion-button-base-bg: #454545; padding-left: 15px; padding-right: 15px; color: #e5e5e5; -} \ No newline at end of file +} diff --git a/ts/sass/scrollbar.scss b/ts/sass/scrollbar.scss new file mode 100644 index 000000000..fe24c769a --- /dev/null +++ b/ts/sass/scrollbar.scss @@ -0,0 +1,32 @@ +/* Copyright: Ankitects Pty Ltd and contributors + * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ + +@use 'vars'; +@use 'buttons'; + +@mixin night-mode { + &::-webkit-scrollbar { + background: var(--window-bg); + + &:horizontal { + height: 12px; + } + + &:vertical { + width: 12px; + } + } + + &::-webkit-scrollbar-thumb { + background: buttons.$fusion-button-hover-bg; + border-radius: 8px; + + &:horizontal { + min-width: 50px; + } + + &:vertical { + min-height: 50px; + } + } +}