Skip to content

Commit 77f1e08

Browse files
authored
Add in light mode (#1013)
* Add light mode
1 parent 4832ead commit 77f1e08

File tree

7 files changed

+86
-8
lines changed

7 files changed

+86
-8
lines changed

Changelog

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Nagios Core 4 Change Log
55
4.5.9 - 2024-XX-XX
66
------------------
77
* Fix unreachable notifications (Dylan Anderson)
8+
* Add light option in new exfoliation theme (Dylan Anderson)
89
* Fix authentication in trends.cgi (Dylan Anderson)
910

1011
4.5.8 - 2024-11-19

contrib/exfoliation/stylesheets/common.css

+43-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ not important: blue aaccff 777777
9191
--background: #000000;
9292
--foreground: #FFFFFF;
9393
--primary: #4D89F9;
94+
--primary-foreground: #FAFAFA;
9495
--secondary-foreground: #D3DAE5;
9596
--muted-foreground: #8A92A1;
9697
--border: #28303E;
@@ -114,6 +115,32 @@ not important: blue aaccff 777777
114115
--error-msg-bg: #1C0202;
115116
}
116117

118+
.light {
119+
--background: #FFFFFF;
120+
--foreground: #000000;
121+
--primary: #4D89F9;
122+
--secondary-foreground: #1A1A1A;
123+
--muted-foreground: #3D3D3D;
124+
--border: #D6D6D6;
125+
--input: #FCFCFC;
126+
127+
--info-msg-text: #033281;
128+
--info-msg-border: #0860F7;
129+
--info-msg-bg: #DCE8FE;
130+
131+
--success-msg-text: #005C2E;
132+
--success-msg-border: #47B880;
133+
--success-msg-bg: #DBFFED;
134+
135+
--warning-msg-text: #5C5900;
136+
--warning-msg-border: #E0D900;
137+
--warning-msg-bg: #FFFEE5;
138+
139+
--error-msg-text: #710B09;
140+
--error-msg-border: #DB2424;
141+
--error-msg-bg: #FCD9D9;
142+
}
143+
117144
#side {
118145
border: none;
119146
height: 100vh;
@@ -183,6 +210,21 @@ a:hover {
183210
margin-bottom: 10px;
184211
}
185212

213+
.nagioslogo {
214+
background-color: var(--foreground);
215+
}
216+
217+
.nlogo {
218+
mask: url(../images/logos/nagios-n-logo.svg) no-repeat center / contain;
219+
height: 32px;
220+
}
221+
222+
.fulllogo {
223+
mask: url(../images/logos/horizontal-nagios-full-logo.svg) no-repeat center / contain;
224+
height: 39px;
225+
width: 140px;
226+
}
227+
186228
div.navsection {
187229
display: flex;
188230
flex-direction: column;
@@ -401,7 +443,7 @@ ul.navsectionlinks li ul li a:hover {
401443

402444
#splashlearnmore {
403445
background-color: var(--primary);
404-
color: var(--foreground);
446+
color: var(--primary-foreground);
405447
padding: 16px;
406448
border-radius: var(--radius);
407449
}

html/config.inc.php.in

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $cfg['cgi_config_file']='@sysconfdir@/cgi.cfg'; // location of the CGI config f
66

77
$cfg['cgi_base_url']='@cgiurl@';
88

9+
$cfg['theme']='dark'; // Valid themes are "dark" or "light". Defaults to dark if something else or not set
910

1011
// FILE LOCATION DEFAULTS
1112
$cfg['main_config_file']='@sysconfdir@/nagios.cfg'; // default location of the main Nagios config file

html/index.php.in

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
require_once(dirname(__FILE__).'/config.inc.php');
3+
24
// Allow specifying main window URL for permalinks, etc.
35
$url = 'main.php';
46

@@ -27,10 +29,14 @@ if ("@COREWINDOW@" == "yes" && isset($_GET['corewindow'])) {
2729
}
2830

2931
$this_year = '2024';
32+
$theme = $cfg['theme'] ?? 'dark';
33+
if ($theme != 'dark' && $theme != 'light') {
34+
$theme = 'dark';
35+
}
3036
?>
3137
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
3238

33-
<html>
39+
<html class="<?= $theme ?>">
3440
<head>
3541
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
3642
<title>Nagios: <?php echo $_SERVER['SERVER_NAME']; ?></title>
@@ -47,12 +53,19 @@ $this_year = '2024';
4753
margin:0;
4854
}
4955

56+
:root {
57+
--border: #28303E
58+
}
59+
60+
.light {
61+
--border: #D6D6D6
62+
}
63+
5064
iframe[name="side"] {
5165
height: 100vh;
5266
width: 200px;
5367
border: none;
54-
/* I don't like doing this but not sure of a better way */
55-
border-right: 1px solid #28303E;
68+
border-right: 1px solid var(--border);
5669
}
5770

5871
iframe[name="main"] {

html/main.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
$this_version = '4.5.8';
55
$this_year = '2024';
6+
$theme = $cfg['theme'] ?? 'dark';
7+
if ($theme != 'dark' && $theme != 'light') {
8+
$theme = 'dark';
9+
}
610
?>
711
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
812

9-
<html id="main">
13+
<html id="main" class="<?= $theme ?>">
1014

1115
<head>
1216

@@ -116,7 +120,7 @@ function setCoreStatusHTML(image, text) {
116120
Nagios Core is licensed under the GNU General Public License and is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. Nagios, Nagios Core and the Nagios logo are trademarks, servicemarks, registered trademarks or registered servicemarks owned by Nagios Enterprises, LLC. Use of the Nagios marks is governed by the <A href="https://www.nagios.com/legal/trademarks/">trademark use restrictions</a>.
117121
</div>
118122
<div class="logos">
119-
<a href="https://www.nagios.org/" target="_blank"><img src="images/logos/nagios-n-logo.svg" title="Nagios.org" /></a>
123+
<a href="https://www.nagios.org/" target="_blank"><div class="nlogo nagioslogo"></div></a>
120124
</div>
121125
</div>
122126

html/side.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
$this_version = '4.5.8';
55
$link_target = 'main';
6+
$theme = $cfg['theme'] ?? 'dark';
7+
if ($theme != 'dark' && $theme != 'light') {
8+
$theme = 'dark';
9+
}
610
?>
711
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
812

9-
<html id="side">
13+
<html id="side" class="<?= $theme ?>">
1014

1115
<head>
1216
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
@@ -18,7 +22,7 @@
1822
<body class='navbar'>
1923

2024
<div class="navbarlogo">
21-
<a href="https://www.nagios.org" target="_blank"><img src="images/logos/horizontal-nagios-full-logo.svg" height="39" width="140" border="0" alt="Nagios" /></a>
25+
<a href="https://www.nagios.org" target="_blank"><div class="fulllogo nagioslogo"></div></a>
2226
</div>
2327

2428
<div class="navsection">

html/stylesheets/common.css

+13
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ body.navbar a:hover,a:active {
7373
margin: 0 0 10px 0;
7474
}
7575

76+
.nlogo {
77+
mask: url(../images/logos/nagios-n-logo.svg) no-repeat center / contain;
78+
height: 32px;
79+
background-color: #000;
80+
}
81+
82+
.fulllogo {
83+
mask: url(../images/logos/horizontal-nagios-full-logo.svg) no-repeat center / contain;
84+
height: 39px;
85+
width: 140px;
86+
background-color: #FFF;
87+
}
88+
7689
.navsection {
7790
margin: 5px 0 10px 0;
7891
/*color: #AAA; */

0 commit comments

Comments
 (0)