diff --git a/scripts/pi-hole/php/theme.php b/scripts/pi-hole/php/theme.php index e9b0d45d..363a307c 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["default-auto"] = array("Pi-hole auto theme (light/dark)", true, "default-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/default-auto.css b/style/themes/default-auto.css new file mode 100644 index 00000000..1c1d2529 --- /dev/null +++ b/style/themes/default-auto.css @@ -0,0 +1,6 @@ +/* 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);