From bda53f0734f67063d7dcd0fa24caa45bc1738ffb Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 18 Mar 2025 17:49:33 +0100 Subject: [PATCH] CSS: Allow more custom styles with dark mode (fix #925) --- CHANGELOG.md | 1 + adminer/include/design.inc.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6527108c..306273a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - PostgreSQL: Display description of system variables - PostgreSQL: Avoid warning about crdb_version (bug #924, regression from 5.0.5) - CSS: Sticky table headers (bug #918) +- CSS: Allow more custom styles with dark mode (bug #925) - IMAP: New plugin driver created for fun ## Adminer 5.0.6 (released 2025-03-17) diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index a96581b4..5e23ff45 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -31,7 +31,11 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { css(); - $dark = (count($css) == 1 ? !!preg_match('~-dark~', $css[0]) : null); + $has_dark = in_array("adminer-dark.css", $css); + $dark = (in_array("adminer.css", $css) + ? ($has_dark ? null : false) // both styles - autoswitching, only adminer.css - light + : ($has_dark ?: null) // only adminer-dark.css - dark, neither - autoswitching + ); if ($dark !== false) { echo "\n"; }