mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 22:56:46 +02:00
Plugins: Allow setting dark mode in css() (bug #1049)
This commit is contained in:
@@ -114,14 +114,18 @@ class Adminer {
|
||||
}
|
||||
|
||||
/** Get URLs of the CSS files
|
||||
* @return list<string>
|
||||
* @return string[] key is URL, value is either 'light' (supports only light color scheme), 'dark' or '' (both)
|
||||
*/
|
||||
function css(): array {
|
||||
$return = array();
|
||||
foreach (array("", "-dark") as $mode) {
|
||||
$filename = "adminer$mode.css";
|
||||
if (file_exists($filename)) {
|
||||
$return[] = "$filename?v=" . crc32(file_get_contents($filename));
|
||||
$file = file_get_contents($filename);
|
||||
$return["$filename?v=" . crc32($file)] = ($mode
|
||||
? "dark"
|
||||
: (preg_match('~prefers-color-scheme:\s*dark~', $file) ? '' : 'light')
|
||||
);
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
Reference in New Issue
Block a user