discourse/app/views/application
Régis Hanol 3dfa25bc41
FIX: Respect forced color mode for logo on server-rendered pages (#37032)
When visiting pages that use the server-rendered header (404, password
reset, invites, etc.), the logo was always using the OS/browser
`prefers-color-scheme` preference instead of respecting the user's
explicit choice made via the interface color selector.

This happened because the `<source>` media query was hardcoded to
`(prefers-color-scheme: dark)`, ignoring the `forced_color_mode` cookie.

Now we use the existing `dark_elements_media_query` helper which returns
the appropriate value based on the user's preference:
- "none" when light mode is forced (hides dark logo)
- "all" when dark mode is forced (shows dark logo)
- "(prefers-color-scheme: dark)" for auto mode (respects OS)

This matches the behavior already implemented for the splash screen.

Ref - t/172056

**BEFORE**

<img width="1529" height="1220" alt="2026-01-09 @ 09 32 28"
src="https://github.com/user-attachments/assets/89c04e53-1360-442f-af27-af0ddc1f526c"
/>

**AFTER**

<img width="1529" height="1220" alt="2026-01-09 @ 09 32 19"
src="https://github.com/user-attachments/assets/75825cd1-9374-4e2f-b98b-e5ba5e4d72f0"
/>
2026-01-09 11:33:06 +01:00
..
_header.html.erb FIX: Respect forced color mode for logo on server-rendered pages (#37032) 2026-01-09 11:33:06 +01:00