Skip to content

Add a theme toggle to the home page and follow the system theme by default#5800

Merged
canova merged 5 commits intofirefox-devtools:mainfrom
canova:theme-selector
Feb 4, 2026
Merged

Add a theme toggle to the home page and follow the system theme by default#5800
canova merged 5 commits intofirefox-devtools:mainfrom
canova:theme-selector

Conversation

@canova
Copy link
Member

@canova canova commented Jan 30, 2026

This PR:

  1. Adds a theme toggle to the home page
  2. Default to using the system theme

Here's the home page after this:
Screenshot 2026-01-30 at 8 16 08 PM

Before / After

@canova canova requested a review from a team as a code owner January 30, 2026 19:18
@canova canova requested review from a team, fatadel and mstange and removed request for a team January 30, 2026 19:18
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 51.00000% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.56%. Comparing base (89082f8) to head (5445a18).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/dark-mode.ts 64.58% 17 Missing ⚠️
src/utils/window-console.ts 0.00% 11 Missing ⚠️
src/components/app/ThemeToggle.tsx 66.66% 10 Missing ⚠️
src/test/custom-environment.js 0.00% 8 Missing ⚠️
src/index.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5800      +/-   ##
==========================================
- Coverage   85.65%   85.56%   -0.09%     
==========================================
  Files         319      320       +1     
  Lines       31343    31419      +76     
  Branches     8546     8649     +103     
==========================================
+ Hits        26846    26884      +38     
- Misses       4066     4104      +38     
  Partials      431      431              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mstange mstange left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

let _isDarkMode = false;

export function isDarkMode() {
export function getSystemPreference(): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name and return type of this function are a bit hard to understand without context. Could this return 'light' | 'dark'? Or maybe 'light' | 'dark' | null? And maybe rename it to getSystemTheme.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yeah, fixed it, thanks!

currentTheme: ThemePreference;
};

class ThemeToggle extends PureComponent<{}, State> {
Copy link
Contributor

Choose a reason for hiding this comment

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

A new component but no hooks? I mean that's fine, I'm just surprised.

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh yeah. well, I feel like it's better to continue using the existing patterns that we have, but we need to do the switch at some point. It could actually be nicer to handle the cleanup for these, but I'll defer that to a follow-up.

@canova canova enabled auto-merge February 4, 2026 15:02
@canova canova merged commit a4e040f into firefox-devtools:main Feb 4, 2026
20 of 22 checks passed
@canova canova mentioned this pull request Feb 4, 2026
canova added a commit that referenced this pull request Feb 4, 2026
Changes:

[Nazım Can Altınova] Make the range duration text white again (#5792)
[Alex Thayer] Display traced values in Stack Chart view (#5363)
[Nazım Can Altınova] Improve the JS traced arguments visualization in
call node tooltips (#5795)
[Markus Stange] Make the argument-values.json profile fixture go through
profile upgrading (#5796)
[Markus Stange] Add thread.usedInnerWindowIDs to the processed profile
format (#5780)
[fatadel] Fix context menu and hover preview z-index (#5797)
[fatadel] add TrackPower--tooltip-power-microwatt (#5799)
[Markus Stange] Two small test fixes (#5801)
[fatadel] fix selected thread pid color in light mode (#5805)
[Markus Stange] Some fixes to the profile merging code (#5802)
[fatadel] fix disabled button color in dark mode (#5808)
[fatadel] add comment for uptime label translation (#5806)
[Nazım Can Altınova] Add a theme toggle to the home page and follow the
system theme by default (#5800)
[Nazım Can Altınova] 🔃 Sync: l10n -> main (Feb 4, 2025) (#5813)

And huge thanks to our localizers:

de: Ger
de: Michael Köhler
de: Nazım Can Altınova
el: Jim Spentzos
en-GB: Ian Neal
es-CL: ravmn
fy-NL: Fjoerfoks
ia: Melo46
it: Francesco Lodolo [:flod]
nl: Mark Heijl
pt-BR: Marcelo Ghelman
ru: Valery Ledovskoy
sv-SE: Andreas Pettersson
tr: Selim Şumlu
zh-TW: Pin-guang Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants