Skip to content

Commit

Permalink
resolve theme
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed Nov 2, 2024
1 parent 5add52c commit ec5f452
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion proxy/js/styles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4922,7 +4922,11 @@ function makeLegendStyle(style) {
},
minzoom: legendZoom,
maxzoom: legendZoom + 1,
paint: {},
paint: {
'text-color': 'black',
'text-halo-color': 'white',
'text-halo-width': 1,
},
layout: {
'text-field': '{legend}',
'text-font': ['Noto Sans Medium'],
Expand Down
9 changes: 5 additions & 4 deletions proxy/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,14 @@ function updateBackgroundMapStyle() {
backgroundMap.setStyle(buildBackgroundMapStyle());
}

function updateTheme() {
const configuredTheme = configuration.theme ?? defaultConfiguration.theme
const resolvedTheme = configuredTheme === 'system'
function resolveTheme(configuredTheme) {
return configuredTheme === 'system'
? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
: configuredTheme;
}

document.documentElement.setAttribute('data-bs-theme', resolvedTheme)
function updateTheme() {
document.documentElement.setAttribute('data-bs-theme', resolveTheme(configuration.theme ?? defaultConfiguration.theme));
}

function updateBackgroundMapContainer() {
Expand Down

0 comments on commit ec5f452

Please sign in to comment.