Skip to content

feat: drop-shadow text effect + gamma-corrected contrast - #576

Merged
RobertMueller2 merged 2 commits into
Satty-org:mainfrom
rokokol:feat/text-effects
Jul 4, 2026
Merged

RobertMueller2 merged 2 commits into
Satty-org:mainfrom
rokokol:feat/text-effects

Conversation

@rokokol

@rokokol rokokol commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #574 (text outline). Two small, independent improvements — one commit each:

  1. 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.

  2. 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.

rokokol added 2 commits July 4, 2026 14:56
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.
@RobertMueller2

Copy link
Copy Markdown
Member

seems like a logical addition now, thanks for the PR :)

@RobertMueller2
RobertMueller2 merged commit 7f5c1a3 into Satty-org:main Jul 4, 2026
3 checks passed
@rokokol
rokokol deleted the feat/text-effects branch September 18, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants