fix: var()-safe lighten() for FungibleTokenInput hover - #12437
Merged
Conversation
MUI lighten() only parses literal colors and throws on var(--mui-palette-maskColor-primary) from the cssVariables theme (#52d5bce737). Add a color-mix based lighten() to @masknet/theme alongside alpha() and use it instead.
swkatmask
force-pushed
the
fix/mui-lighten-css-var
branch
from
September 5, 2026 15:49
098b40a to
3eb13e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
FungibleTokenInputcrashed on render:Root cause
Introduced by the MUI v9 upgrade (#52d5bce737), which enabled
cssVariables: { colorSchemeSelector: 'data' }and switchedtheme.palette.*→theme.vars.palette.*. The latter is now the literalstring
var(--mui-palette-maskColor-primary), and MUI'slighten()onlyparses
#nnn/rgb()/hsl()/color(), so it throws. The call sitsinside
useStyles(), so the component crashed on mount. This was the lastlighten/darkenusage left ontheme.vars.Change
color-mix-basedlighten()to@masknet/themenext to theexisting var()-safe
alpha()(color-mix(in srgb, ${color}, white ${coefficient * 100}%))— channel-wise identical to MUI's
lightenfor rgb colors, so the hovercolor is unchanged visually.
lightenfrom@masknet/themeinFungibleTokenInputinstead of@mui/material(call site unchanged).Verification
pnpm lintcleanFungibleTokenInputwithout the MUI error; the injected.selectToken:hoverrule resolves in Chrome to exactlylighten(#1C68F3, 0.1)=rgb(51, 119, 244), matching the pre-upgrade color