feat: color anti-aliasing for subcell-shape charsets - #47
Merged
Conversation
Make --color-aa a typed Option<AaStrength> via FromStr so clap rejects invalid values with a helpful error instead of silently falling back to Off; remove the hand-rolled parse-and-ignore paths in resolved_color_aa and the runner. Replace the duplicated [AaStrength; 7] literals with a NUM_CHARSETS const tied to ALL_CHARSETS.len(), so per-charset arrays stay locked to the charset count. Drop two provably-dead per-cell bounds checks in the blur hot loop in favor of a single debug_assert on the width*height invariant.
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
Subcell-shape charsets (Braille, Quadrant, HalfBlock, Ascii) render shape at 2–4× resolution but carry a single foreground color per terminal cell, so thin diagonal veins staircase in color (visible even in
--palette mono— it's brightness-domain, not a hue bug). This pre-blurs the per-cell color signal with a 3×3 kernel so color washes into a gradient while the glyph stays crisp (the shape path reads raw quadrant data, untouched).What's included
AaStrength { Off, Subtle, Strong }per-charset color-AA, stored as[AaStrength; 7]indexed by charset. Default: Braille = Strong, all others Off.Strong= uniform 3×3 box blur;Subtle= weighted-center (0.5·self + 0.5·mean(neighbors)).diff_normaccent field with one kernel.--color-aa <off|subtle|strong>(auto: strong for braille, off otherwise), runtime"key (cycles active charset's AA), options-overlay "Color AA" row,--explain+ README docs.Test plan
cargo test --lib— 869 green (881 with--all-features)cargo test --test cli_integration/integration_app— greencargo clippy --all-targets --all-features -- -D warnings,cargo fmt --check— cleanlumen_presetgolden is a pre-existing macOS-vs-Linux temporal divergence unrelated to this change (CI/Linux is source of truth).Vec<f32>per blurred field per frame).Notes