Improve screen layout for themes + Radar layout adjustments

This commit is contained in:
mrkmntal 2026-04-11 12:02:24 -04:00
commit fef73485dd
8 changed files with 52 additions and 11 deletions

View file

@ -45,11 +45,15 @@ class CurrentWeather extends WeatherDisplay {
const wind = this.data.WindSpeed > 0
? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ')
: 'Calm';
const isDefaultTheme = (document.documentElement.dataset.theme ?? 'default') === 'default';
const windText = !isDefaultTheme && this.data.WindGust > 0
? `${wind} - Gusts to ${this.data.WindGust}`
: wind;
const fill = {
temp: this.data.Temperature + String.fromCharCode(176),
condition,
wind,
wind: windText,
location: this.data.city.substr(0, 20),
humidity: `${this.data.Humidity}%`,
dewpoint: this.data.DewPoint + String.fromCharCode(176),
@ -59,7 +63,7 @@ class CurrentWeather extends WeatherDisplay {
icon: { type: 'img', src: this.data.Icon },
};
if (this.data.WindGust > 0) fill['wind-gusts'] = `Gusts to ${this.data.WindGust}`;
if (isDefaultTheme && this.data.WindGust > 0) fill['wind-gusts'] = `Gusts to ${this.data.WindGust}`;
const area = this.elem.querySelector('.main');
area.innerHTML = '';

View file

@ -57,6 +57,7 @@ const getThemeAssetUrl = (themeName, assetKey) => {
const applyTheme = (themeName) => {
const selectedTheme = getAvailableThemes().includes(themeName) ? themeName : DEFAULT_THEME;
localStorage.setItem(THEME_STORAGE_KEY, selectedTheme);
document.documentElement.dataset.theme = selectedTheme;
document.documentElement.style.setProperty('--theme-background-1', `url('${getThemeAssetUrl(selectedTheme, 'background1')}')`);
document.documentElement.style.setProperty('--theme-background-1-chart', `url('${getThemeAssetUrl(selectedTheme, 'background1Chart')}')`);