feat: OKLCH palette — perceptually-uniform preset colours#60
Closed
LeslieOA wants to merge 2 commits into
Closed
Conversation
All six preset colours (codes 1–6) now live in OKLCH space at a common L=0.62 / C≈0.175–0.19, with hue rotating around the wheel. Yellow (code 3) carries L=0.78 because that is perceptually correct — equal perceived vividness requires higher lightness on yellow. The old HSL presets at L=55% read noticeably uneven: yellow was brighter, green darker. Colour derivations (card, border, background, activeTransparent) now use use-color's OKLCH-native operations instead of hand-rolled HSL math — which removes ~60 lines of bespoke hslToRgb / hexToHsl helpers. Public API unchanged: getNodeColors / getCanvasBackground / getMutedTextColor / resolveScheme all have the same signatures. Skia consumers keep receiving plain #rrggbb / #rrggbbaa strings. Adds src/renderer/__tests__/theme.test.ts: 34 tests covering output shape, activeTransparent contract, no-colour defaults, preset distinctness, dark/light card contrast, hex input, unknown code fallback, and utility functions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The /core subpath resolves only via the package `exports` field — it has no file fallback. The main `use-color` entry has `main`/`module` fields, so it resolves under Metro regardless of `unstable_enablePackageExports`. Since this is a published library, depending on an exports-only subpath would silently require every downstream consumer's Metro to enable package-exports. The main entry avoids that at a ~negligible cost (full bundle is a superset of core). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
Member
Author
|
Closing without merging. OKLCH produced no user-visible win for this codebase (see #61 for the full post-mortem): native gradient interpolation is unavailable in the RN Skia binding and moot for single-hue fades; a uniform-OKLCH palette flattened the intended Obsidian/hesprs vibrancy; and OKLCH anchored on the real hexes is ≈identical to the existing HSL while adding a runtime dep. Keeping the canonical HSL palette. Branch deleted. |
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
theme.tswith OKLCH presets viause-color(zero-dep, OKLCH-native, gamut-mapping built in)hslToRgb/hexToHsl/rgbToHexhelpers; card/border/background derivations use OKLCH-native.alpha()/fromOklch()getNodeColors,getCanvasBackground,getMutedTextColor,resolveSchemehave identical signatures; Skia consumers still receive plain#rrggbb/#rrggbbaause-colormain entry (not the/coresubpath) so resolution works under Metro without requiring downstream consumers to enable package-exportsNew preset colours (active hex)
#d1453b#e24947#d86b2d#d85c00#d4a017#d2b71e#2d7a3a#2aa03a#2980d4#009ad0#8b5fd4#9b67dcTest plan
theme.test.ts)hesprs-demo/Gradients.canvas, confirm all 6 colour codes render visually balanced — no single hue dominating in brightness#rrggbbin canvas JSON) still produce valid palettes🤖 Generated with Claude Code
Closes #61