-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: Improved useTheme Hook and Unlock Page Logo Theme Handling
#38002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (2 files, +7 -7)
👨🔧 @MetaMask/core-extension-ux (1 files, +2 -2)
|
Builds ready [bea787b]
UI Startup Metrics (1242 ± 88 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
useTheme Hook and Unlock Page Logo Theme Handling
Builds ready [6e878b9]
UI Startup Metrics (1236 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
LeVinhGithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm QA
ccharly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for accounts owned files
Builds ready [839eae4]
UI Startup Metrics (1223 ± 87 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR improves the
useThemehook implementation to provide more robust theme resolution and updates the unlock page logo to properly respond to theme changes.1. Enhanced
useThemeHook (ui/hooks/useTheme.ts)resolveTheme()function for better code organization and testabilitylightordark)2. Unlock Page Logo Component (
ui/pages/unlock-page/)MetaMaskWordmarkLogocomponent that responds to theme changesuseThemehook for dynamic theme-aware rendering3. Test Snapshots Updates
Updated Jest snapshots to reflect the new consistent theme behavior:
ui/components/multichain-accounts/smart-contract-account-toggle/__snapshots__/smart-contract-account-toggle.test.tsx.snapui/components/multichain/network-list-menu/__snapshots__/network-list-menu.test.tsx.snapui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snapui/pages/settings/security-tab/__snapshots__/security-tab.test.js.snapWhy snapshots changed:
The improved
useThemehook now properly resolves tolighttheme by default in tests (instead ofundefined), causingToggleButtoncomponents to consistently render with light theme colors (rgb(183, 187, 200)=#b7bbc8=lightTheme.colors.icon.muted).Changelog
CHANGELOG entry: Updated useTheme hook and logo for unlock page
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2025-11-20.at.2.53.01.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Refactors
useThemefor reliable light/dark resolution and updates the unlock page wordmark logo to respond to theme, with minor CSS tweaks and snapshot updates.useTheme: ExtractsresolveTheme(settingTheme)with clear priority (explicit setting > OS when selected > document on initial load > system), validates againstvalidThemes, warns and defaults tolightif invalid; initializes state via resolver and applies on setting changes.MetamaskWordmarkLogo: UsesuseThemeand rendersMetaFoxHorizontalLogowith theme awareness; replaces direct logo usage inunlock-page.component.js.unlock-page__mascot-container__horizontal-logo--popupmargins with responsive override.rgb(183, 187, 200), onrgb(68, 89, 255)).Written by Cursor Bugbot for commit 839eae4. This will update automatically on new commits. Configure here.