Skip to content

Commit 1a68b99

Browse files
Add support for “intensity” modifiers on box and text shadows (#17398)
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.
1 parent 5e255de commit 1a68b99

File tree

9 files changed

+652
-213
lines changed

9 files changed

+652
-213
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- _Experimental_: Add `text-shadow-*` utilities ([#17389](https://github.com/tailwindlabs/tailwindcss/pull/17389))
2424
- Added new `bg-{top,bottom}-{left,right}` utilities ([#17378](https://github.com/tailwindlabs/tailwindcss/pull/17378))
2525
- Added new `bg-{position,size}-*` utilities for arbitrary values ([#17432](https://github.com/tailwindlabs/tailwindcss/pull/17432))
26+
- Added new `shadow-*/{alpha}`, `inset-shadow-*/{alpha}`, and `text-shadow-*/{alpha}` utilities to control shadow opacity ([#17398](https://github.com/tailwindlabs/tailwindcss/pull/17398))
2627

2728
### Fixed
2829

packages/tailwindcss/src/__snapshots__/index.test.ts.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
3636
inherits: false
3737
}
3838
39+
@property --tw-shadow-alpha {
40+
syntax: "<percentage>";
41+
inherits: false;
42+
initial-value: 100%;
43+
}
44+
3945
@property --tw-inset-shadow {
4046
syntax: "*";
4147
inherits: false;
@@ -47,6 +53,12 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
4753
inherits: false
4854
}
4955
56+
@property --tw-inset-shadow-alpha {
57+
syntax: "<percentage>";
58+
inherits: false;
59+
initial-value: 100%;
60+
}
61+
5062
@property --tw-ring-color {
5163
syntax: "*";
5264
inherits: false

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4672,6 +4672,27 @@ exports[`getClassList 1`] = `
46724672
"inset-ring-transparent/95",
46734673
"inset-ring-transparent/100",
46744674
"inset-shadow",
4675+
"inset-shadow/0",
4676+
"inset-shadow/5",
4677+
"inset-shadow/10",
4678+
"inset-shadow/15",
4679+
"inset-shadow/20",
4680+
"inset-shadow/25",
4681+
"inset-shadow/30",
4682+
"inset-shadow/35",
4683+
"inset-shadow/40",
4684+
"inset-shadow/45",
4685+
"inset-shadow/50",
4686+
"inset-shadow/55",
4687+
"inset-shadow/60",
4688+
"inset-shadow/65",
4689+
"inset-shadow/70",
4690+
"inset-shadow/75",
4691+
"inset-shadow/80",
4692+
"inset-shadow/85",
4693+
"inset-shadow/90",
4694+
"inset-shadow/95",
4695+
"inset-shadow/100",
46754696
"inset-shadow-current",
46764697
"inset-shadow-current/0",
46774698
"inset-shadow-current/5",
@@ -4717,7 +4738,29 @@ exports[`getClassList 1`] = `
47174738
"inset-shadow-inherit/95",
47184739
"inset-shadow-inherit/100",
47194740
"inset-shadow-initial",
4741+
"inset-shadow-none",
47204742
"inset-shadow-sm",
4743+
"inset-shadow-sm/0",
4744+
"inset-shadow-sm/5",
4745+
"inset-shadow-sm/10",
4746+
"inset-shadow-sm/15",
4747+
"inset-shadow-sm/20",
4748+
"inset-shadow-sm/25",
4749+
"inset-shadow-sm/30",
4750+
"inset-shadow-sm/35",
4751+
"inset-shadow-sm/40",
4752+
"inset-shadow-sm/45",
4753+
"inset-shadow-sm/50",
4754+
"inset-shadow-sm/55",
4755+
"inset-shadow-sm/60",
4756+
"inset-shadow-sm/65",
4757+
"inset-shadow-sm/70",
4758+
"inset-shadow-sm/75",
4759+
"inset-shadow-sm/80",
4760+
"inset-shadow-sm/85",
4761+
"inset-shadow-sm/90",
4762+
"inset-shadow-sm/95",
4763+
"inset-shadow-sm/100",
47214764
"inset-shadow-transparent",
47224765
"inset-shadow-transparent/0",
47234766
"inset-shadow-transparent/5",
@@ -7306,6 +7349,27 @@ exports[`getClassList 1`] = `
73067349
"sepia-50",
73077350
"sepia-100",
73087351
"shadow",
7352+
"shadow/0",
7353+
"shadow/5",
7354+
"shadow/10",
7355+
"shadow/15",
7356+
"shadow/20",
7357+
"shadow/25",
7358+
"shadow/30",
7359+
"shadow/35",
7360+
"shadow/40",
7361+
"shadow/45",
7362+
"shadow/50",
7363+
"shadow/55",
7364+
"shadow/60",
7365+
"shadow/65",
7366+
"shadow/70",
7367+
"shadow/75",
7368+
"shadow/80",
7369+
"shadow/85",
7370+
"shadow/90",
7371+
"shadow/95",
7372+
"shadow/100",
73097373
"shadow-current",
73107374
"shadow-current/0",
73117375
"shadow-current/5",
@@ -7757,6 +7821,27 @@ exports[`getClassList 1`] = `
77577821
"text-pretty",
77587822
"text-right",
77597823
"text-shadow",
7824+
"text-shadow/0",
7825+
"text-shadow/5",
7826+
"text-shadow/10",
7827+
"text-shadow/15",
7828+
"text-shadow/20",
7829+
"text-shadow/25",
7830+
"text-shadow/30",
7831+
"text-shadow/35",
7832+
"text-shadow/40",
7833+
"text-shadow/45",
7834+
"text-shadow/50",
7835+
"text-shadow/55",
7836+
"text-shadow/60",
7837+
"text-shadow/65",
7838+
"text-shadow/70",
7839+
"text-shadow/75",
7840+
"text-shadow/80",
7841+
"text-shadow/85",
7842+
"text-shadow/90",
7843+
"text-shadow/95",
7844+
"text-shadow/100",
77607845
"text-shadow-current",
77617846
"text-shadow-current/0",
77627847
"text-shadow-current/5",

packages/tailwindcss/src/index.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,12 @@ describe('Parsing theme values from CSS', () => {
14991499
inherits: false
15001500
}
15011501
1502+
@property --tw-shadow-alpha {
1503+
syntax: "<percentage>";
1504+
inherits: false;
1505+
initial-value: 100%;
1506+
}
1507+
15021508
@property --tw-inset-shadow {
15031509
syntax: "*";
15041510
inherits: false;
@@ -1510,6 +1516,12 @@ describe('Parsing theme values from CSS', () => {
15101516
inherits: false
15111517
}
15121518
1519+
@property --tw-inset-shadow-alpha {
1520+
syntax: "<percentage>";
1521+
inherits: false;
1522+
initial-value: 100%;
1523+
}
1524+
15131525
@property --tw-ring-color {
15141526
syntax: "*";
15151527
inherits: false

0 commit comments

Comments
 (0)