From 5538af20b8afea77f146715c19ddcf8363ca4958 Mon Sep 17 00:00:00 2001 From: AlexLamond <9060360+AlexLamond@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:39:29 +0100 Subject: [PATCH 1/3] Added the option for an automatic dark mode based on the device status Signed-off-by: = <9060360+AlexLamond@users.noreply.github.com> Signed-off-by: Alex Lamond <9060360+AlexLamond@users.noreply.github.com> --- scripts/pi-hole/php/theme.php | 5 ++++- style/themes/custom-auto.css | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 style/themes/custom-auto.css diff --git a/scripts/pi-hole/php/theme.php b/scripts/pi-hole/php/theme.php index e9b0d45d..02d60906 100644 --- a/scripts/pi-hole/php/theme.php +++ b/scripts/pi-hole/php/theme.php @@ -16,6 +16,8 @@ $available_themes = array(); $available_themes["default-light"] = array("Pi-hole default theme (light, default)", false, "default-light"); $available_themes["default-dark"] = array("Pi-hole midnight theme (dark)", true, "default-dark"); $available_themes["default-darker"] = array("Pi-hole deep-midnight theme (dark)", true, "default-darker"); +// Option to have the theme go with the device dark mode setting, always set the background to black to avoid flashing +$available_themes["custom-auto"] = array("Pi-hole auto theme (light/dark)", true, "custom-auto"); $webtheme = ""; // Try to load theme settings from setupVars.conf @@ -45,4 +47,5 @@ function theme_selection() { \ No newline at end of file + +?> diff --git a/style/themes/custom-auto.css b/style/themes/custom-auto.css new file mode 100644 index 00000000..2a277e75 --- /dev/null +++ b/style/themes/custom-auto.css @@ -0,0 +1,7 @@ +/* Code courtesy of https://blog.jim-nielsen.com/2019/conditional-syntax-highlighting-in-dark-mode-with-css-imports/ */ + +/* Assume light mode by default */ +@import "default-light.css" screen; +/* Supersede dark mode when applicable */ +@import "default-dark.css" screen and (prefers-color-scheme: dark); + From 57a5518c23c32806261fd22976015a1625d9c075 Mon Sep 17 00:00:00 2001 From: Alex L <9060360+AlexLamond@users.noreply.github.com> Date: Tue, 22 Jun 2021 10:28:08 +0200 Subject: [PATCH 2/3] Update scripts/pi-hole/php/theme.php Corrected naming conventions for files and theme name Co-authored-by: DL6ER Signed-off-by: Alex Lamond <9060360+AlexLamond@users.noreply.github.com> --- scripts/pi-hole/php/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/theme.php b/scripts/pi-hole/php/theme.php index 02d60906..363a307c 100644 --- a/scripts/pi-hole/php/theme.php +++ b/scripts/pi-hole/php/theme.php @@ -17,7 +17,7 @@ $available_themes["default-light"] = array("Pi-hole default theme (light, defaul $available_themes["default-dark"] = array("Pi-hole midnight theme (dark)", true, "default-dark"); $available_themes["default-darker"] = array("Pi-hole deep-midnight theme (dark)", true, "default-darker"); // Option to have the theme go with the device dark mode setting, always set the background to black to avoid flashing -$available_themes["custom-auto"] = array("Pi-hole auto theme (light/dark)", true, "custom-auto"); +$available_themes["default-auto"] = array("Pi-hole auto theme (light/dark)", true, "default-auto"); $webtheme = ""; // Try to load theme settings from setupVars.conf From 7aace0920b35954c6d740e9370dedce7c886d083 Mon Sep 17 00:00:00 2001 From: Alex Lamond <9060360+AlexLamond@users.noreply.github.com> Date: Tue, 22 Jun 2021 12:50:20 +0200 Subject: [PATCH 3/3] Updated theme naming Signed-off-by: Alex Lamond <9060360+AlexLamond@users.noreply.github.com> --- style/themes/{custom-auto.css => default-auto.css} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename style/themes/{custom-auto.css => default-auto.css} (85%) diff --git a/style/themes/custom-auto.css b/style/themes/default-auto.css similarity index 85% rename from style/themes/custom-auto.css rename to style/themes/default-auto.css index 2a277e75..1c1d2529 100644 --- a/style/themes/custom-auto.css +++ b/style/themes/default-auto.css @@ -2,6 +2,5 @@ /* Assume light mode by default */ @import "default-light.css" screen; -/* Supersede dark mode when applicable */ +/* Supersede dark mode when applicable */ @import "default-dark.css" screen and (prefers-color-scheme: dark); -