Skip to content

Commit cd7f3e9

Browse files
committed
Fix display of Bootstrap components in dark mode (#364)
1 parent 0f330fe commit cd7f3e9

File tree

5 files changed

+35
-4
lines changed

5 files changed

+35
-4
lines changed

frontend/src/lib/bootstrap.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ $enable-gradients: true;
44

55
$secondary: #fff;
66

7+
$color-mode-type: media-query;
8+
79

810
// Bootstrap import, see https://getbootstrap.com/docs/5.3/customize/optimize/
911

@@ -107,6 +109,27 @@ html,body {
107109
@include button-outline-variant(#6c757d);
108110
}
109111

112+
// Above, we override $secondary with white like in Bootstrap 3 instead of gray like in Bootstrap 4/5. In dark mode, use gray again.
113+
@include color-mode(dark) {
114+
$color: secondary;
115+
$value: $gray-600;
116+
117+
.btn-#{$color} {
118+
@include button-variant($value, $value);
119+
120+
$border: darken($value, 14%);
121+
--#{$prefix}btn-border-color: #{$border};
122+
--#{$prefix}btn-hover-border-color: #{darken($border, 12%)};
123+
--#{$prefix}btn-active-border-color: #{$border};
124+
125+
--#{$prefix}btn-hover-bg: #{darken($value, 12%)};
126+
--#{$prefix}btn-active-bg: #{darken($value, 12%)};
127+
--#{$prefix}btn-disabled-bg: #{darken($value, 12%)};
128+
129+
@include gradient-y($start-color: $value, $end-color: darken($value, 12%));
130+
}
131+
}
132+
110133
.list-group-item.active a {
111134
color: inherit;
112135
}

frontend/src/lib/components/leaflet-map/leaflet-map.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@
218218
outline: none;
219219
}
220220
221+
.leaflet-pane {
222+
color-scheme: only light;
223+
}
224+
221225
}
222226
223227
&.isNarrow {

frontend/src/lib/components/legend/legend-content.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,8 @@
220220
}
221221
}
222222
}
223+
224+
.fm-legend-icon {
225+
color-scheme: only light;
226+
}
223227
</style>

frontend/src/lib/components/search-box/search-box.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@
416416
cursor: nwse-resize;
417417
border: 1px solid #ddd;
418418
border-radius: 1000px;
419-
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
420-
background: #fff;
421-
color: #666;
419+
box-shadow: 0 1px 2px rgba(var(--bs-body-color), .075);
420+
background: var(--bs-body-bg);
421+
color: var(--bs-secondary-text-emphasis);
422422
padding: 2px;
423423
424424
display: flex;

frontend/src/lib/components/ui/sidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
</div>
103103
</template>
104104

105-
<nav v-if="!context.isNarrow" class="navbar navbar-expand bg-light">
105+
<nav v-if="!context.isNarrow" class="navbar navbar-expand bg-body-tertiary">
106106
<div class="container-fluid" :ref="(el) => { if (el) { teleportTargetRef = el as any; } }"></div>
107107
</nav>
108108

0 commit comments

Comments
 (0)