Repository navigation
feat: drop-shadow text effect + gamma-corrected contrast - #576
Merged
Merged
Conversation
Compute the black/white contrast color from the WCAG relative luminance (sRGB channels gamma-decoded to linear light, then perceptually weighted) instead of a raw YIQ sum, using the L = 0.179 crossover where black and white contrast equally. This picks the more legible color on mid-tones. Add a small with_alpha helper used by upcoming translucent decorations.
Generalize the Alt-cycled text outline into a small set of effects: the former OutlineMode becomes TextEffect and each variant now yields a Decoration describing what is drawn behind the fill (an outline stroke or an offset shadow duplicate). Adds a Shadow variant to the cycle: none -> inverted outline -> contrast outline -> drop shadow.
Member
|
seems like a logical addition now, thanks for the PR :) |
1 task
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.
Follow-up to #574 (text outline). Two small, independent improvements — one commit each:
Drop-shadow effect 3794dc2
Generalizes the Alt-cycled outline into a small TextEffect set. Each variant yields a Decoration describing what's drawn behind the
fill (an outline stroke, or an offset shadow duplicate), so new effects are one enum variant + one match arm. New cycle: none → inverted outline → contrast outline → drop shadow.
Gamma-corrected contrast e8f623a
Color::contrast() now uses WCAG relative luminance (sRGB channels gamma-decoded to linear light, then perceptually weighted), with the L = 0.179 black/white crossover, instead of a raw YIQ sum. More legible choice on mid-tones. Also adds a small Color::with_alpha helper.
README.md updated (effect list, still flagged experimental). make fix clean; both commits build standalone.