From 87ddb434afb88a70f3e8735fbcc93eaf1af5b2ee Mon Sep 17 00:00:00 2001 From: Odd-Harald Date: Fri, 10 Apr 2026 13:38:09 +0200 Subject: [PATCH] Add support for disabling dark theme to get light theme only --- scss/_settings.scss | 4 +++ scss/pico.classless.light.scss | 6 +++++ scss/themes/default/_schemes.scss | 44 ++++++++++++++++++------------- 3 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 scss/pico.classless.light.scss diff --git a/scss/_settings.scss b/scss/_settings.scss index d1c3e4620..4df7d429e 100644 --- a/scss/_settings.scss +++ b/scss/_settings.scss @@ -38,6 +38,10 @@ $enable-transitions: true !default; // Enable overriding with !important $enable-important: true !default; +// Enable dark mode +// Light-only mode if disabled +$enable-dark-mode: true !default; + // Optional parent selector // If defined, all HTML tags are wrapped with this selector // :root is not wrapped diff --git a/scss/pico.classless.light.scss b/scss/pico.classless.light.scss new file mode 100644 index 000000000..84faced0c --- /dev/null +++ b/scss/pico.classless.light.scss @@ -0,0 +1,6 @@ +// Pico classless light-only version +@use "index" with ( + $enable-semantic-container: true, + $enable-classes: false, + $enable-dark-mode: false +); diff --git a/scss/themes/default/_schemes.scss b/scss/themes/default/_schemes.scss index 295884e13..9eaed7557 100644 --- a/scss/themes/default/_schemes.scss +++ b/scss/themes/default/_schemes.scss @@ -9,27 +9,35 @@ * Color schemes */ - // Light color scheme (Default) - // Can be forced with data-theme="light" - [data-theme="light"], - :root:not([data-theme="dark"]), - :host(:not([data-theme="dark"])) { - @include light.theme; - } + @if $enable-dark-mode { + // Light color scheme (Default) + // Can be forced with data-theme="light" + [data-theme="light"], + :root:not([data-theme="dark"]), + :host(:not([data-theme="dark"])) { + @include light.theme; + } - // Dark color scheme (Auto) - // Automatically enabled if user has Dark mode enabled - @media only screen and (prefers-color-scheme: dark) { - :root:not([data-theme]), - :host(:not([data-theme])) { - @include dark.theme; + // Dark color scheme (Auto) + // Automatically enabled if user has Dark mode enabled + @media only screen and (prefers-color-scheme: dark) { + :root:not([data-theme]), + :host(:not([data-theme])) { + @include dark.theme; + } } - } - // Dark color scheme (Forced) - // Enabled if forced with data-theme="dark" - [data-theme="dark"] { - @include dark.theme; + // Dark color scheme (Forced) + // Enabled if forced with data-theme="dark" + [data-theme="dark"] { + @include dark.theme; + } + } @else { + // Light-only mode + :root, + :host { + @include light.theme; + } } #{$parent-selector} progress,