Skip to content

Commit

Permalink
feat: use svg for static icons (#366)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Kissling <[email protected]>
  • Loading branch information
amondit and pkissling authored Apr 30, 2024
1 parent 3b2a609 commit 7699642
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 188 deletions.
4 changes: 2 additions & 2 deletions src/clock-weather-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { actionHandler } from './action-handler-directive'
import { localize } from './localize/localize'
import { type HassEntityBase } from 'home-assistant-js-websocket'
import { extractMostOccuring, max, min, round, roundDown, roundIfNotNull, roundUp } from './utils'
import { svg, png } from './images'
import { animatedIcons, staticIcons } from './images'
import { version } from '../package.json'
import { safeRender } from './helpers'
import { DateTime } from 'luxon'
Expand Down Expand Up @@ -437,7 +437,7 @@ export class ClockWeatherCard extends LitElement {

private toIcon (weatherState: string, type: 'fill' | 'line', forceDay: boolean, kind: 'static' | 'animated'): string {
const daytime = forceDay ? 'day' : this.getSun()?.state === 'below_horizon' ? 'night' : 'day'
const iconMap = kind === 'animated' ? svg : png
const iconMap = kind === 'animated' ? animatedIcons : staticIcons
const icon = iconMap[type][weatherState]
return icon?.[daytime] || icon
}
Expand Down
Loading

0 comments on commit 7699642

Please sign in to comment.