Skip to content

Commit 02406f5

Browse files
author
Marko Petzold
committed
fix: color handling
1 parent eb5e777 commit 02406f5

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

src/widget-value.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,21 @@ export class WidgetValue extends LitElement {
158158
const label: string | null = box.getAttribute('label')
159159
const ds: Dataseries | undefined = this.dataSets.get(label ?? '')
160160

161-
const numberText = box.querySelector('.current-value') as HTMLDivElement
162-
numberText.setAttribute(
163-
'style',
164-
`font-size: ${32 * modifier}px;
165-
color: ${ds?.styling?.valueColor || this.theme?.theme_object?.color?.[0] || this.themeTitleColor};`
166-
)
167-
168161
const labelText = box.querySelector('.label') as HTMLDivElement
169162
labelText.setAttribute(
170163
'style',
171164
`font-size: ${26 * modifier}px;
172-
color: ${ds?.styling?.labelColor || this.theme?.theme_object?.color?.[1] || this.themeSubtitleColor};`
165+
color: ${ds?.styling?.labelColor || this.themeTitleColor};`
173166
)
174-
const unitText = box.querySelector('.unit') as HTMLDivElement
175-
unitText.setAttribute(
167+
const numberText = box.querySelector('.current-value') as HTMLDivElement
168+
numberText.setAttribute(
176169
'style',
177-
`font-size: ${26 * modifier}px;
170+
`font-size: ${32 * modifier}px;
178171
color: ${ds?.styling?.valueColor || this.theme?.theme_object?.color?.[0] || this.themeTitleColor};`
179172
)
173+
174+
const unitText = box.querySelector('.unit') as HTMLDivElement
175+
unitText.setAttribute('style', `font-size: ${26 * modifier}px;`)
180176
}
181177

182178
this.textActive = true
@@ -352,7 +348,9 @@ export class WidgetValue extends LitElement {
352348
<span
353349
class="current-value paging"
354350
?active=${this.textActive}
355-
style="color: ${this.themeTitleColor}"
351+
style="color: ${ds?.styling?.valueColor ||
352+
this.theme?.theme_object?.color?.[0] ||
353+
this.themeTitleColor}"
356354
>
357355
${ds.needleValue === undefined ||
358356
ds.needleValue === null ||
@@ -374,11 +372,19 @@ export class WidgetValue extends LitElement {
374372
([label, ds]) => {
375373
return html`
376374
<div class="single-value" label="${label}">
377-
<div class="label paging" ?active=${this.textActive}>${label}</div>
375+
<div
376+
class="label paging"
377+
style="color: ${ds?.styling?.labelColor || this.themeTitleColor}"
378+
?active=${this.textActive}
379+
>
380+
${label}
381+
</div>
378382
<span
379383
class="current-value paging"
380384
?active=${this.textActive}
381-
style="color: ${this.themeTitleColor}"
385+
style="color: ${ds?.styling?.valueColor ||
386+
this.theme?.theme_object?.color?.[0] ||
387+
this.themeTitleColor}"
382388
>
383389
${ds.needleValue === undefined ||
384390
ds.needleValue === null ||

0 commit comments

Comments
 (0)