diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9662611f..53da30c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## Adminer dev
+- Designs: adminer.css with 'prefers-color-scheme: dark' don't disable dark mode
- Plugins: Method bodyClass() to add <body class>
## Adminer 5.2.1 (released 2025-04-11)
diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php
index 5469b5bc..5f3d1dce 100644
--- a/adminer/include/design.inc.php
+++ b/adminer/include/design.inc.php
@@ -27,14 +27,19 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s
css();
$has_light = false;
$has_dark = false;
- foreach ($css as $filename) {
- if (strpos($filename, "adminer.css") !== false) {
+ foreach ($css as $url) {
+ if (strpos($url, "adminer.css") !== false) {
$has_light = true;
+ $filename = preg_replace('~\?.*~', '', $url);
+ if (!preg_match('~:~', $url) && is_readable($filename) && preg_match('~prefers-color-scheme:\s*dark~', file_get_contents($filename))) {
+ $has_dark = true;
+ }
}
- if (strpos($filename, "adminer-dark.css") !== false) {
+ if (strpos($url, "adminer-dark.css") !== false) {
$has_dark = true;
}
}
@@ -47,6 +52,7 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s
echo "\n";
}
echo "\n";
+
// this is matched by compile.php
echo script_src("../adminer/static/functions.js");
echo script_src("static/editing.js");