Repository navigation
Phone app: warning colour is a real hex again - #2122
Merged
Merged
Conversation
The tokens generator converts each OKLCH colour to sRGB hex for the phone app. A colour outside sRGB has a linear channel below zero, and the transfer function raised that negative number to a fractional power, giving NaN before the clip ran. Warning is outside sRGB in both modes, so the phone drew #bb4dNaN (light) and #ffb9NaN (dark). The converter now clips the linear channel before encoding, so warning comes out #bb4d00 and #ffb900, the same as culori's clamped conversion of the web app's tokens. No other colour changes. The tokens tests now check that every colour in the phone's copy is a hex React Native can draw, and that its warning matches the web app's warning token in app/src/theme.css.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 24, 2026 07:28
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.
The phone app's warning colour was
#bb4dNaNin light mode and#ffb9NaNin dark, which React Native can't draw.Cause.
mobile/src/scheme.tsis generated bybun run tokens:generatefromtokens/src/scheme.ts, converting each OKLCH colour to sRGB hex. Warning is outside sRGB in both modes, so its blue linear channel is below zero. The transfer function raised that negative number to a fractional power (NaN) before the clip ran, and the clip let NaN through.Fix.
tokens/src/color.tsclips the linear channel to 0..1 before encoding. Warning is now#bb4d00(light) and#ffb900(dark), matching culori 4.0.2's clamped conversion of the web app's tokens. Regenerated: only the two warning lines change; the web, desktop and first-paint copies are unchanged.Tests (
tokens/tests/generated.test.ts):#rrggbbor#rrggbbaahex--warningfromapp/src/theme.css, light and darkRed before the fix (3 failing,
Received: "#bb4dNaN"), green after (12 pass).