Skip to content

Add support for “intensity” modifiers on box and text shadows #17398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 28, 2025

Conversation

thecrypticace
Copy link
Contributor

This PR adds support for utilities like:

  • text-shadow-lg/25

It uses relative color syntax to replace the alpha value of the shadow from your theme.

When combined with a colors:

  • text-shadow-lg/25 text-shadow-red-500
  • text-shadow-lg/25 text-shadow-red-500/75

The alpha values are multiplied resulting in a shadow with the color specified in --color-red-500 and alpha values of 25% and 18.75% respectively.

@thecrypticace thecrypticace force-pushed the feat/shadow-intensity-modifier branch 4 times, most recently from 594e7f9 to a7b00c5 Compare March 27, 2025 14:45
@thecrypticace thecrypticace marked this pull request as ready for review March 27, 2025 14:47
@thecrypticace thecrypticace requested a review from a team as a code owner March 27, 2025 14:47
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, I also wonder/wish we could only enable features like this if you use them 🤔

Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like it.

@thecrypticace
Copy link
Contributor Author

@adamwathan you cool with the name --tw-shadow-intensity? I could use --tw-shadow-alpha too if you'd prefer that.

Base automatically changed from feat/text-shadows to main March 28, 2025 17:06
@thecrypticace thecrypticace force-pushed the feat/shadow-intensity-modifier branch from d542f87 to 95187e8 Compare March 28, 2025 17:07
@thecrypticace thecrypticace force-pushed the feat/shadow-intensity-modifier branch from 95187e8 to 393c812 Compare March 28, 2025 17:08
@thecrypticace thecrypticace merged commit 1a68b99 into main Mar 28, 2025
6 checks passed
@thecrypticace thecrypticace deleted the feat/shadow-intensity-modifier branch March 28, 2025 17:16
philipp-spiess added a commit that referenced this pull request Apr 11, 2025
…and `text-shadow-inherit` (#17647)

Fixes #17643.

This PR completely removes the `color-mix()` function for
`shadow-inherit`. This does mean intensity and alpha channel support has
been removed when using `shadow-inherit`[^1].

With intensity modifiers in #17398, all colors are wrapped in
`color-mix()`. However, it seems `inherit` does not work as a value in
`color-mix()` in Firefox or Chrome (don't have a means to test Safari).

[^1]: While writing this, I noticed other color utilities allow alpha
channel modifier syntax for `inherit` - do we want to look at removing
those too?

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
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