From 09fa2d2c9cd90bd6b472641a862434f53b31f13a Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 28 Nov 2022 12:38:30 +0000 Subject: [PATCH] Cleaned up dark mode styles inc. setting browser color scheme Forces browser colorscheme based on BookStack color scheme, via 'color-scheme' css property. Sets proper dark mode colors for some previously missed areas like templates and attachment control buttons. Also fixed search bar icon position for some search inputs. --- resources/sass/_blocks.scss | 5 +++-- resources/sass/_components.scss | 8 +++++--- resources/sass/_lists.scss | 3 ++- resources/sass/_variables.scss | 4 ++++ resources/views/entities/search-form.blade.php | 2 +- resources/views/pages/parts/template-manager.blade.php | 2 +- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/resources/sass/_blocks.scss b/resources/sass/_blocks.scss index 37b7b403b..2794dd954 100644 --- a/resources/sass/_blocks.scss +++ b/resources/sass/_blocks.scss @@ -109,7 +109,8 @@ } .card.border-card { - border: 1px solid #DDD; + border: 1px solid; + @include lightDark(border-color, #ddd, #000); } .card.drag-card { @@ -133,7 +134,7 @@ flex-grow: 0; padding: 0 $-xs; &:hover { - background-color: #EEE; + @include lightDark(background-color, #eee, #2d2d2d); } .svg-icon { margin-inline-end: 0px; diff --git a/resources/sass/_components.scss b/resources/sass/_components.scss index ff60cd50a..ab1d506c7 100644 --- a/resources/sass/_components.scss +++ b/resources/sass/_components.scss @@ -812,14 +812,16 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group { height: 100%; display: flex; flex-direction: column; - border-inline-start: 1px solid #DDD; + border-inline-start: 1px solid; + @include lightDark(border-color, #ddd, #000); } .template-item-actions button { cursor: pointer; flex: 1; - background: #FFF; + @include lightDark(background-color, #FFF, #222); border: 0; - border-top: 1px solid #DDD; + border-top: 1px solid; + @include lightDark(border-color, #DDD, #000); } .template-item-actions button svg { margin: 0; diff --git a/resources/sass/_lists.scss b/resources/sass/_lists.scss index 8926eb7f9..86a89051f 100644 --- a/resources/sass/_lists.scss +++ b/resources/sass/_lists.scss @@ -284,7 +284,8 @@ padding-inline-start: $-m; } li { - border: 1px solid #DDD; + border: 1px solid; + @include lightDark(border-color, #DDD, #666); margin-top: -1px; min-height: 38px; } diff --git a/resources/sass/_variables.scss b/resources/sass/_variables.scss index 3cb2dd4ed..e1242bdda 100644 --- a/resources/sass/_variables.scss +++ b/resources/sass/_variables.scss @@ -51,6 +51,10 @@ $fs-s: 12px; :root.dark-mode { --bg-disabled: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25'%3E%3Cdefs%3E%3Cpattern id='doodad' width='19' height='19' viewBox='0 0 40 40' patternUnits='userSpaceOnUse' patternTransform='rotate(143)'%3E%3Crect width='100%25' height='100%25' fill='rgba(42, 67, 101,0)'/%3E%3Cpath d='M-10 30h60v20h-60zM-10-10h60v20h-60' fill='rgba(26, 32, 44,0)'/%3E%3Cpath d='M-10 10h60v20h-60zM-10-30h60v20h-60z' fill='rgba(255, 255, 255,0.05)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23doodad)' height='200%25' width='200%25'/%3E%3C/svg%3E"); + color-scheme: only dark; +} +:root:not(.dark-mode) { + color-scheme: only light; } $positive: #0f7d15; diff --git a/resources/views/entities/search-form.blade.php b/resources/views/entities/search-form.blade.php index b65d5df94..1a1f785e6 100644 --- a/resources/views/entities/search-form.blade.php +++ b/resources/views/entities/search-form.blade.php @@ -5,6 +5,6 @@ \ No newline at end of file diff --git a/resources/views/pages/parts/template-manager.blade.php b/resources/views/pages/parts/template-manager.blade.php index 43c161ad2..c209626cd 100644 --- a/resources/views/pages/parts/template-manager.blade.php +++ b/resources/views/pages/parts/template-manager.blade.php @@ -13,7 +13,7 @@