Skip to content

Commit 313645f

Browse files
Fixes #20827: fix theme toggle visibility for logo and buttons
1 parent d7877b7 commit 313645f

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

netbox/project-static/dist/netbox.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/dist/rack_elevation.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/styles/overrides/_tabler.scss

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Disable font-ligatures for Chromium based browsers
22
// Chromium requires `font-variant-ligatures: none` in addition to `font-feature-settings "liga" 0`
33
* {
4-
font-feature-settings: "liga" 0;
4+
font-feature-settings: 'liga' 0;
55
font-variant-ligatures: none;
66
}
77

@@ -57,7 +57,8 @@ pre {
5757
}
5858

5959
// Altering background colors
60-
.page, .page-tabs .nav-tabs .nav-link.active {
60+
.page,
61+
.page-tabs .nav-tabs .nav-link.active {
6162
background-color: var(--#{$prefix}bg-surface-tertiary) !important;
6263
}
6364

@@ -70,23 +71,23 @@ pre {
7071
// Dark mode colors
7172
@if $enable-dark-mode {
7273
@include color-mode(dark, true) {
73-
--#{$prefix}alert-color: darken(var(--#{$prefix}warning),10%);
74+
--#{$prefix}alert-color: darken(var(--#{$prefix}warning), 10%);
7475
--#{$prefix}link-color: #{$bright-teal};
75-
--#{$prefix}link-color-rgb: 0,242,212;
76-
--#{$prefix}link-hover-color-rgb: 0,242,212;
76+
--#{$prefix}link-color-rgb: 0, 242, 212;
77+
--#{$prefix}link-hover-color-rgb: 0, 242, 212;
7778
--#{$prefix}secondary: #{$gray-400};
7879
--#{$prefix}primary: #{$bright-teal};
7980
--#{$prefix}primary-fg: #{$rich-black};
80-
--#{$prefix}primary-rgb: 0,242,212;
81+
--#{$prefix}primary-rgb: 0, 242, 212;
8182
--#{$prefix}btn-active-color: #{$rich-black};
8283
}
8384
}
8485

8586
// Dark mode overrides
86-
body[data-bs-theme=dark] {
87+
body[data-bs-theme='dark'] {
8788
// Override background color alpha value
8889
::selection {
89-
background-color: rgba(var(--tblr-primary-rgb),.48);
90+
background-color: rgba(var(--tblr-primary-rgb), 0.48);
9091
}
9192

9293
.btn-primary {
@@ -95,7 +96,9 @@ body[data-bs-theme=dark] {
9596

9697
// Change content color when primary teal changes with theme
9798
.bg-primary {
98-
.card-title,a,i {
99+
.card-title,
100+
a,
101+
i {
99102
color: $rich-black !important;
100103
}
101104
}
@@ -110,14 +113,17 @@ body[data-bs-theme=dark] {
110113

111114
// Background colors to match brand colors
112115
background-color: $rich-black;
113-
.navbar, .page-header {
116+
.navbar,
117+
.page-header {
114118
background-color: $rich-black;
115119
}
116-
.page, .page-tabs .nav-tabs .nav-link.active {
120+
.page,
121+
.page-tabs .nav-tabs .nav-link.active {
117122
background-color: $rich-black-light !important;
118123
}
119124

120-
.page-link.active, .active>.page-link {
125+
.page-link.active,
126+
.active > .page-link {
121127
color: $rich-black;
122128
}
123129

@@ -152,13 +158,28 @@ pre code {
152158
}
153159

154160
// Use an icon instead of Tabler's native "caret" for dropdowns (avoids a Safari bug)
155-
.dropdown-toggle:after{
156-
font-family: "Material Design Icons";
161+
.dropdown-toggle:after {
162+
font-family: 'Material Design Icons';
157163
content: '\F0140';
158164
padding-right: 9px;
159165
border-bottom: none;
160166
border-left: none;
161167
transform: none;
162-
vertical-align: .05em;
168+
vertical-align: 0.05em;
163169
height: auto;
164170
}
171+
172+
// Theme-based visibility utilities
173+
// Tabler's .hide-theme-* utilities expect data-bs-theme on :root, but NetBox applies
174+
// it to body. These overrides use higher specificity selectors to ensure theme-based
175+
// visibility works correctly. The :root:not(.dummy) pattern provides the additional
176+
// specificity needed to override Tabler's :root:not() rules.
177+
:root:not(.dummy) body[data-bs-theme='light'] .hide-theme-light,
178+
:root:not(.dummy) body[data-bs-theme='dark'] .hide-theme-dark {
179+
display: none !important;
180+
}
181+
182+
:root:not(.dummy) body[data-bs-theme='dark'] .hide-theme-light,
183+
:root:not(.dummy) body[data-bs-theme='light'] .hide-theme-dark {
184+
display: inline-flex !important;
185+
}

0 commit comments

Comments
 (0)