feat: add compile-time raw color helpers - #18
Draft
e-simpson wants to merge 6 commits into
Draft
Conversation
e-simpson
force-pushed
the
codex/raw-color-utilities
branch
from
July 28, 2026 18:48
4a03217 to
6ba04fb
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.
Summary
Adds compile-time helpers for React Native APIs that need raw color strings rather than style objects:
twColorresolves one static module- or component-scope token with zero runtime work and rejectsscheme:.useTwColor()anduseTwColors()resolve reactive scheme colors with the Babel plugin's configured custom or native theme hook.Dependency / merge order
Please merge #14, then #15, then #18.
This draft is intentionally stacked on #14 and #15 so raw colors are already verified with arbitrary opacity and
scheme:outline-*. Until those PRs land, GitHub shows their commits here; the base diff reduces after each dependency merges.Static and reactive contracts
twColoraccepts one interpolation-free token and rejects runtimescheme:with an error directing callers touseTwColor.Type checking
The Babel plugin validates tokens against the actual consumer Tailwind config. Since a package declaration cannot automatically infer another project's Babel-loaded config, the base TypeScript signature remains
string.Applications can retain config-derived autocomplete and typo checking without wrappers:
The compiler now unwraps
satisfies,as, and type-assertion expressions around direct literals before compiling them.Validation
bun run spec— 1,096 passed, 1 skippedbun run checkbun run lintbun run format:checkbun run buildgit diff --check