diff --git a/app/assets/main.css b/app/assets/main.css index 25853a7cd..0f17e32ca 100644 --- a/app/assets/main.css +++ b/app/assets/main.css @@ -171,6 +171,26 @@ } } +/* + * Forced Colors Mode (WHCM) Override for Icons + * + * By default, `forced-color-adjust: preserve-parent-color` (from UnoConfig) works fine + * for most icons as they inherit the correct text color. + * + * However, if icons disappear in specific contexts (e.g., inside buttons with + * complex backgrounds or transparent states), uncomment the following block + * to enforce visibility using `CanvasText`. + */ +/* +@media (forced-colors: active) { + [class^='i-'], + [class*=' i-'] { + forced-color-adjust: none !important; + color: CanvasText !important; + } +} +*/ + html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/app/components/Settings/AccentColorPicker.vue b/app/components/Settings/AccentColorPicker.vue index 768976d05..c9ae3387d 100644 --- a/app/components/Settings/AccentColorPicker.vue +++ b/app/components/Settings/AccentColorPicker.vue @@ -59,3 +59,18 @@ onPrehydrate(el => { + + diff --git a/app/components/Settings/BgThemePicker.vue b/app/components/Settings/BgThemePicker.vue index 68332928c..1428aa85d 100644 --- a/app/components/Settings/BgThemePicker.vue +++ b/app/components/Settings/BgThemePicker.vue @@ -37,3 +37,18 @@ onPrehydrate(el => { + + diff --git a/app/components/Settings/Toggle.client.vue b/app/components/Settings/Toggle.client.vue index 4a5905e1e..977c603ba 100644 --- a/app/components/Settings/Toggle.client.vue +++ b/app/components/Settings/Toggle.client.vue @@ -51,4 +51,31 @@ button[aria-checked='true'] > span:last-of-type > span { html[dir='rtl'] button[aria-checked='true'] > span:last-of-type > span { translate: calc(-100%); } + +@media (forced-colors: active) { + /* make toggle tracks and thumb visible in forced colors. */ + button[role='switch'] { + & > span:last-of-type { + forced-color-adjust: none; + } + + &[aria-checked='false'] > span:last-of-type { + background: Canvas; + border-color: CanvasText; + + & > span { + background: CanvasText; + } + } + + &[aria-checked='true'] > span:last-of-type { + background: Highlight; + border-color: Highlight; + + & > span { + background: HighlightText; + } + } + } +} diff --git a/app/pages/index.vue b/app/pages/index.vue index 88395fee5..64bd828cd 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -123,7 +123,7 @@ defineOgImageComponent('Default', {
  • {{ framework.name }} @@ -139,3 +139,13 @@ defineOgImageComponent('Default', { + + diff --git a/uno.config.ts b/uno.config.ts index 033a45d91..a9bbeba56 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -22,7 +22,8 @@ export default defineConfig({ presetWind4(), presetIcons({ extraProperties: { - display: 'inline-block', + 'display': 'inline-block', + 'forced-color-adjust': 'preserve-parent-color', }, warn: true, scale: 1.2,