diff --git a/components/color-theme/element.js b/components/color-theme/element.js index 639017a99..96c8de9b5 100644 --- a/components/color-theme/element.js +++ b/components/color-theme/element.js @@ -17,11 +17,11 @@ export class MDNColorTheme extends L10nMixin(LitElement) { super(); /** @type {import("./types.js").ColorScheme} */ this._mode = "light dark"; - this._options = Object.entries({ + this._options = { "light dark": this.l10n("theme-default")`OS default`, light: this.l10n`Light`, dark: this.l10n`Dark`, - }); + }; } /** @param {MouseEvent} event */ @@ -43,6 +43,10 @@ export class MDNColorTheme extends L10nMixin(LitElement) { } } + get _theme() { + return this._options[this._mode] ?? this.l10n`Theme`; + } + /** * @param {import("lit").PropertyValues} changedProperties */ @@ -70,7 +74,7 @@ export class MDNColorTheme extends L10nMixin(LitElement) { type="button" aria-label=${this.l10n`Switch color theme`} > - ${this.l10n`Theme`} + ${this._theme}