Simplify theme handling (#2718)

This commit is contained in:
DL6ER
2023-09-29 20:42:36 +02:00
committed by GitHub
3 changed files with 4 additions and 61 deletions
+3 -3
View File
@@ -64,7 +64,7 @@ is_authenticated = mg.request_info.is_authenticated
<link rel="icon" href="<?=pihole.webhome()?>img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="<?=pihole.webhome()?>img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="<?=pihole.webhome()?>img/favicons/manifest.json">
<? pihole.include('scripts/pi-hole/lua/theme.lua') ?>
<? theme = pihole.webtheme() ?>
<link rel="mask-icon" href="<?=pihole.webhome()?>img/favicons/safari-pinned-tab.svg" color="<?=theme.color?>">
<link rel="shortcut icon" href="<?=pihole.webhome()?>img/favicons/favicon.ico">
<meta name="msapplication-TileColor" content="<?=theme.color?>">
@@ -80,7 +80,7 @@ is_authenticated = mg.request_info.is_authenticated
<? end ?>
<!-- Theme fonts -->
<? if pihole.webtheme() == 'lcars' then ?>
<? if theme.name == 'lcars' then ?>
<link rel="stylesheet" href="<?=pihole.fileversion('style/vendor/fonts/ubuntu-mono/ubuntu-mono.css')?>">
<link rel="stylesheet" href="<?=pihole.fileversion('style/vendor/fonts/antonio/antonio.css')?>">
<? else ?>
@@ -107,7 +107,7 @@ if startsWith(scriptname, 'groups') then
<!-- Theme styles -->
<link rel="stylesheet" href="<?=pihole.fileversion('style/pi-hole.css')?>">
<link rel="stylesheet" href="<?=pihole.fileversion('style/themes/'..pihole.webtheme()..'.css')?>">
<link rel="stylesheet" href="<?=pihole.fileversion('style/themes/'..theme.name..'.css')?>">
<noscript><link rel="stylesheet" href="<?=pihole.fileversion('style/vendor/js-warn.css')?>"></noscript>
+1 -1
View File
@@ -17,7 +17,7 @@ mg.include('header.lp','r')
<script src="<?=pihole.fileversion('scripts/vendor/chart.min.js')?>"></script>
<script src="<?=pihole.fileversion('scripts/vendor/chartjs-adapter-moment.js')?>"></script>
</head>
<body class="<?=pihole.webtheme()?> hold-transition sidebar-mini <? if pihole.boxedlayout() then ?>layout-boxed<? end ?> logged-in">
<body class="<?=theme.name?> hold-transition sidebar-mini <? if pihole.boxedlayout() then ?>layout-boxed<? end ?> logged-in">
<noscript>
<!-- JS Warning -->
<div>
-57
View File
@@ -1,57 +0,0 @@
--[[
* Pi-hole: A black hole for Internet advertisements
* (c) 2023 Pi-hole, LLC (https://pi-hole.net)
* Network-wide ad blocking via your own hardware.
*
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license.
]]--
available_themes = {}
available_themes['default-light'] = {
name = 'Pi-hole default theme (light, default)',
dark = false,
color = '#367fa9'
}
available_themes['default-dark'] = {
name = 'Pi-hole midnight theme (dark)',
dark = true,
color = '#272c30'
}
available_themes['default-darker'] = {
name = 'Pi-hole deep-midnight theme (dark)',
dark = true,
color = '#2e6786'
}
available_themes['high-contrast'] = {
name = 'High contrast light',
dark = false,
color = '#0078a0'
}
available_themes['high-contrast-dark'] = {
name = 'High contrast dark',
dark = true,
color = '#0077c7'
}
-- Option to have the theme go with the device dark mode setting, always set the
-- background to black to avoid flashing
available_themes['default-auto'] = {
name = 'Pi-hole auto theme (light/dark)',
dark = true,
color = '#367fa9'
}
available_themes['lcars'] = {
name = 'Star Trek LCARS theme (dark)',
dark = true,
color = '#4488FF'
}
-- Get properties of currently selected theme by asking FTL what the currently
-- enabled theme is
theme = available_themes[pihole.webtheme()]