close
Skip to content

[2.x] feat: add dark mode logo support#4457

Merged
imorland merged 3 commits intoflarum:2.xfrom
rafaucau:feat/dark-mode-logo
Mar 15, 2026
Merged

[2.x] feat: add dark mode logo support#4457
imorland merged 3 commits intoflarum:2.xfrom
rafaucau:feat/dark-mode-logo

Conversation

@rafaucau
Copy link
Copy Markdown
Contributor

@rafaucau rafaucau commented Mar 15, 2026

Changes proposed in this pull request:

Not every logo works well in both light and dark mode. For example:

Light mode Dark mode
light-mode dark-mode

This PR adds an option to set an alternative logo for dark mode.
If no dark mode logo is set, the regular logo is used in dark mode.

Screenshot

Light mode Dark mode
light-mode-after dark-mode-after

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@rafaucau rafaucau requested a review from a team as a code owner March 15, 2026 13:45
Copy link
Copy Markdown
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, will look over this!

Copy link
Copy Markdown
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature, clean implementation. A few notes:

Change request:

The dark logo <img> has no base display: none rule, so browsers without :has() support (notably Firefox < 121) will render both logos simultaneously. Adding:

.Header-logo--dark-mode {
  display: none;
}

as a base rule would give correct graceful degradation — those browsers would simply always show the regular logo.

Notes (non-blocking):

  • The dark logo is not used in HTML mail templates — email dark mode support is too inconsistent for this to be practical, just worth documenting as a known limitation.
  • [data-theme^='dark'] correctly covers dark-hc (dark high contrast), so high contrast users get the dark logo. No separate variant is possible, but that's a reasonable limitation for now.
  • No tests, consistent with the existing light logo situation — not a blocker.

@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 15, 2026
@rafaucau
Copy link
Copy Markdown
Contributor Author

rafaucau commented Mar 15, 2026

@imorland .Header-logo--dark-mode is already hidden by default.

https://github.com/rafaucau/flarum-framework/blob/9498eb2101e01b1323ec77de4c2370eae00ac1b5/framework/core/less/common/App.less#L187-L189

So in browsers without :has() support, this will gracefully fall back to the current behavior and continue showing the regular logo.

@rafaucau rafaucau requested a review from imorland March 15, 2026 15:47
Copy link
Copy Markdown
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the confusion — you're right, the base rule is already there. Change request was incorrect. LGTM!

Copy link
Copy Markdown
Member

@imorland imorland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the confusion — you're right, the base display:none rule is already there. Change request was incorrect. LGTM!

@imorland imorland merged commit f6911ca into flarum:2.x Mar 15, 2026
21 checks passed
@rafaucau rafaucau deleted the feat/dark-mode-logo branch March 15, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants