render: add theme.minimum_contrast #218
Labels
No labels
Area/ci
Area/cli
Area/client
Area/client-core
Area/daemon
Area/deps
Area/docs
Area/grid
Area/manual
Area/nix
Area/protocol
Area/pty
Area/render
Area/shaping
Area/skills
Area/transport
Area/vt
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Security
Kind/Testing
perf-regression-accepted
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Blocked
Status
Need More Info
Status
Upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
felis-terminal/felis#218
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A program that hard-codes SGR colors can render text that a user's theme makes unreadable (blue on a dark background, light gray on a light theme). No layer outside the terminal can fix this: the program does not know the theme, and the theme does not know the program. Ghostty (
minimum-contrast), kitty (text_fg_override_threshold), WezTerm (text_min_contrast_ratio) and iTerm2 all offer a minimum-contrast setting; felis has none.Proposal (0.3.x, additive, default off)
theme.minimum_contrast: a WCAG 2 contrast ratio in [1, 21], default1(output identical to today). Out-of-range values clamp with a warning.resolve_cell(crates/felis-render-core/src/appearance.rs) after the faint step, so it judges the final fg against the final bg: reverse video, selection and block cursor follow without extra work.resolve_cell).ResolvedThemeholds the premultiplied default bg (premultiplied_bg/refresh_themeincrates/felis-render-wgpu/src/lib.rs), so the straight color must be carried alongside it. The desktop behind the window is not considered.theme.*keys do.Principle check: principle 3 puts colors with the client; principle 4 is not engaged because the rule reads resolved colors, never characters; principle 2 (parity with kitty) holds.
Cascade via the
add-config-keyskill: schema,docs/reference/config.md, home-manager module, CHANGELOG. Tests: unit tests beside the faint tests (default is identity, passing pairs untouched, failing pairs reach the target, fg == bg and bidi untouched, judged against the post-reverse/selection bg), a proptest that the result meets the ratio whenever it is reachable, and a golden row at 4.5.