diff --git a/src/components/timetable-occupancy-icon/timetable-occupancy-icon.ts b/src/components/timetable-occupancy-icon/timetable-occupancy-icon.ts index f0e372f791..9bba090a3b 100644 --- a/src/components/timetable-occupancy-icon/timetable-occupancy-icon.ts +++ b/src/components/timetable-occupancy-icon/timetable-occupancy-icon.ts @@ -44,10 +44,13 @@ export class SbbTimetableOccupancyIcon extends SbbIconBase { } let icon = `utilization-${this.occupancy}`; - if (window.matchMedia('(forced-colors: active)').matches) { + if (globalThis.window?.matchMedia('(forced-colors: active)').matches) { // high contrast icon += '-high-contrast'; - } else if (this.negative || window.matchMedia('(prefer-color-scheme: dark)').matches) { + } else if ( + this.negative || + globalThis.window?.matchMedia('(prefer-color-scheme: dark)').matches + ) { // dark icon += '-negative'; }