Add custom brand colors via ordered colors prop (web + SwiftUI) - #7
Open
devinpatell wants to merge 1 commit into
Open
Add custom brand colors via ordered colors prop (web + SwiftUI)#7devinpatell wants to merge 1 commit into
colors prop (web + SwiftUI)#7devinpatell wants to merge 1 commit into
Conversation
Implements Jakubantalik#4: an ordered list of user colors that recolors every palette family while preserving the hand-tuned geometry and per-stop alphas of the 'colorful' reference. Colors cycle through the gradient stops (the first is the most prominent), always render with static hue so brand colors stay exact, and take precedence over colorVariant; invalid or empty input falls back to the preset. - Web: strict color parsing (hex / rgb / rgba, percentage channels, values clamped like CSS), custom palette builder threaded through every CSS generator, palette memoized per distinct color list - iOS: BeamCustomPalette recolors the spec's reference tables; colors resolve against the live SwiftUI environment so adaptive colors track appearance; custom palettes keep the tuned brightness/saturate as a static filter (and the line bloom keeps its blur) - Spec: customColors contract (reference variant, forced static colors, line-bloom recolor map) so ports cannot drift - Tests: full bloom-map + cycling coverage in both themes, custom-color snapshot matrix; 14/14 pass incl. under xcodebuild with compiled Metal shaders; preset output verified byte-identical to HEAD across all 80 combinations - Demos: "Custom" palette option with live ordered color editors (SwiftUI ColorPicker row / web playground color inputs, 1-5 colors, add/remove) - Docs: README custom colors section, prop docs, changelog; version 1.5.0 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #4.
What this adds
An ordered list of custom colors on both platforms:
colorfulreference palette is preserved — only the colors are swapped, across all five palette families (border ring, small, line, line-inner, line-bloom).colorstakes precedence overcolorVariantand always renders with static hue (likemono) so brand colors stay exact; the tuned brightness/saturate still apply as a static filter.#rgb,#rgba,#rrggbb,#rrggbbaa) andrgb()/rgba()with number or percentage channels; alpha is ignored (layers manage their own opacity). Entries that fail to parse are skipped; if nothing parses,colorVariantapplies. On iOS,[Color]resolves against the live SwiftUI environment so adaptive colors track appearance changes.Cross-platform parity
The derivation contract lives in
beam-spec.json § customColors(reference variant, forced static colors, line-bloom recolor map[0,1,0,1,2,3,4]), so the web (buildCustomPalettesinstyles.ts) and iOS (BeamCustomPalette.swift) implementations recolor the same spec tables and cannot silently drift. Executing both derivations against the same input and diffing numerically produced an exact match across every family, both themes, all alphas.Verification
mainacross all 80 preset combinations (5 sizes × 4 variants × 2 themes × 2 static modes).swift testandxcodebuild testwith compiled Metal shaders; new tests pin the full line-bloom color map in both themes, cycling + alpha retention in every family, sRGB (gamma) color resolution, and a custom-color snapshot matrix.Demos
Both demos gained a Custom entry in the palette switcher with live ordered color editors (1–5 colors, add/remove): native
ColorPickerrow in the SwiftUI demo, color inputs in the web playground. The playground's generated snippet updates to the realcolors={[…]}usage as you edit.Notes
BeamColorVariantis intentionally left unextended (a new case would be source-breaking forString-raw-value +CaseIterableconsumers); custom colors are a separate parameter on both platforms.🤖 Generated with Claude Code