[pve-devel] [PATCH manager] pveproxy/template: switch to using the "auto" theme per default
Stefan Sterz
s.sterz at proxmox.com
Tue Mar 14 15:01:59 CET 2023
the auto theme uses media queries to detect a users preferred theme,
switch to using it per default instead of the light theme.
Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
PVE/Service/pveproxy.pm | 5 ++++-
www/index.html.tpl | 8 ++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index 3fd76128..7b305f76 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -215,6 +215,10 @@ sub get_index {
}
}
+ if ($theme eq "") {
+ $theme = "auto"
+ }
+
if (!$lang) {
my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg');
$lang = $dc_conf->{language} // 'en';
@@ -264,7 +268,6 @@ sub get_index {
version => "$version",
wtversion => $wtversion,
theme => $theme,
- auto => $theme == "auto",
};
# by default, load the normal index
diff --git a/www/index.html.tpl b/www/index.html.tpl
index be31dd40..b07ce5f1 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -12,11 +12,11 @@
<link rel="stylesheet" type="text/css" href="/pve2/fa/css/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="/pve2/css/ext6-pve.css?ver=[% version %]" />
<link rel="stylesheet" type="text/css" href="/pwt/css/ext6-pmx.css?ver=[% wtversion %]" />
- [%- IF theme %]
- [%- IF theme == 'auto' %]
- <link rel="stylesheet" type="text/css" media="(prefers-color-scheme: dark)" href="/pwt/themes/theme-proxmox-dark.css?ver=[% wtversion %]" />
- [%- ELSE %]
+ [%- IF theme != 'crisp' %]
+ [%- IF theme != 'auto' %]
<link rel="stylesheet" type="text/css" href="/pwt/themes/theme-[% theme %].css?ver=[% wtversion %]" />
+ [%- ELSE %]
+ <link rel="stylesheet" type="text/css" media="(prefers-color-scheme: dark)" href="/pwt/themes/theme-proxmox-dark.css?ver=[% wtversion %]" />
[%- END -%]
[%- END -%]
--
2.30.2
More information about the pve-devel
mailing list