feat: implement ThemeHelper class to centralize theme management and improve color handling across various pages

This commit is contained in:
Zack Spear
2025-04-03 18:10:05 -07:00
parent 4b6014439d
commit f041c83a92
11 changed files with 204 additions and 45 deletions
@@ -20,12 +20,13 @@ Markdown="false"
<?
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
$themeName = $themeHelper->getThemeName();
$cpus = cpu_list();
$hover = in_array($theme,['white','azure']) ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.1)';
$bgcolor = in_array($theme,['white','azure']) ? '#f2f2f2' : '#1c1c1c';
$fgcolor = in_array($theme,['white','azure']) ? '#1c1c1c' : '#f2f2f2';
$incolor = $theme!='gray' ? $bgcolor : '#121510';
$hover = $themeHelper->isLightTheme() ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.1)';
$bgcolor = $themeHelper->isLightTheme() ? '#f2f2f2' : '#1c1c1c';
$fgcolor = $themeHelper->isLightTheme() ? '#1c1c1c' : '#f2f2f2';
$incolor = $themeName !== 'gray' ? $bgcolor : '#121510';
function showCPUs($uuid) {
global $cpus;
@@ -92,7 +92,7 @@ if (is_file('/boot/syslinux/syslinux.cfg')) {
$arrValidNetworks = getValidNetworks();
$pcie_acs_override = detect($bootcfg, $bootenv, 'pcie_acs_override');
$vfio_allow_unsafe = detect($bootcfg, $bootenv, 'allow_unsafe_interrupts');
$bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c';
$bgcolor = $themeHelper->isLightTheme() ? '#f2f2f2' : '#1c1c1c';
$started = $var['fsState']=='Started';
$libvirt_up = $libvirt_running=='yes';
$libvirt_log = file_exists("/var/log/libvirt/libvirtd.log");