@@ -129,24 +129,13 @@ export function withAlpha(value: string, alpha: string): string {
129
129
/**
130
130
* Resolve a color value + optional opacity modifier to a final color.
131
131
*/
132
- export function asColor (
133
- value : string ,
134
- modifier : CandidateModifier | null ,
135
- theme : Theme ,
136
- ) : string | null {
132
+ export function asColor ( value : string , modifier : CandidateModifier | null ) : string | null {
137
133
if ( ! modifier ) return value
138
134
139
135
if ( modifier . kind === 'arbitrary' ) {
140
136
return withAlpha ( value , modifier . value )
141
137
}
142
138
143
- // Check if the modifier exists in the `opacity` theme configuration and use
144
- // that value if so.
145
- let alpha = theme . resolve ( modifier . value , [ '--opacity' ] )
146
- if ( alpha ) {
147
- return withAlpha ( value , alpha )
148
- }
149
-
150
139
if ( Number . isNaN ( Number ( modifier . value ) ) ) {
151
140
return null
152
141
}
@@ -208,7 +197,7 @@ function resolveThemeColor<T extends ColorThemeKey>(
208
197
}
209
198
}
210
199
211
- return value ? asColor ( value , candidate . modifier , theme ) : null
200
+ return value ? asColor ( value , candidate . modifier ) : null
212
201
}
213
202
214
203
export function createUtilities ( theme : Theme ) {
@@ -360,7 +349,7 @@ export function createUtilities(theme: Theme) {
360
349
value = candidate . value . value
361
350
362
351
// Apply an opacity modifier to the value if appropriate.
363
- value = asColor ( value , candidate . modifier , theme )
352
+ value = asColor ( value , candidate . modifier )
364
353
} else {
365
354
value = resolveThemeColor ( candidate , theme , desc . themeKeys )
366
355
}
@@ -2241,7 +2230,7 @@ export function createUtilities(theme: Theme) {
2241
2230
return [ borderProperties ( ) , ...decls ]
2242
2231
}
2243
2232
default : {
2244
- value = asColor ( value , candidate . modifier , theme )
2233
+ value = asColor ( value , candidate . modifier )
2245
2234
if ( value === null ) return
2246
2235
2247
2236
return desc . color ( value )
@@ -2549,7 +2538,7 @@ export function createUtilities(theme: Theme) {
2549
2538
return [ decl ( 'background-image' , value ) ]
2550
2539
}
2551
2540
default : {
2552
- value = asColor ( value , candidate . modifier , theme )
2541
+ value = asColor ( value , candidate . modifier )
2553
2542
if ( value === null ) return
2554
2543
2555
2544
return [ decl ( 'background-color' , value ) ]
@@ -2625,7 +2614,7 @@ export function createUtilities(theme: Theme) {
2625
2614
return desc . position ( value )
2626
2615
}
2627
2616
default : {
2628
- value = asColor ( value , candidate . modifier , theme )
2617
+ value = asColor ( value , candidate . modifier )
2629
2618
if ( value === null ) return
2630
2619
2631
2620
return desc . color ( value )
@@ -2763,7 +2752,7 @@ export function createUtilities(theme: Theme) {
2763
2752
if ( candidate . negative || ! candidate . value ) return
2764
2753
2765
2754
if ( candidate . value . kind === 'arbitrary' ) {
2766
- let value = asColor ( candidate . value . value , candidate . modifier , theme )
2755
+ let value = asColor ( candidate . value . value , candidate . modifier )
2767
2756
if ( value === null ) return
2768
2757
return [ decl ( 'fill' , value ) ]
2769
2758
}
@@ -2801,7 +2790,7 @@ export function createUtilities(theme: Theme) {
2801
2790
return [ decl ( 'stroke-width' , value ) ]
2802
2791
}
2803
2792
default : {
2804
- value = asColor ( candidate . value . value , candidate . modifier , theme )
2793
+ value = asColor ( candidate . value . value , candidate . modifier )
2805
2794
if ( value === null ) return
2806
2795
2807
2796
return [ decl ( 'stroke' , value ) ]
@@ -3099,7 +3088,7 @@ export function createUtilities(theme: Theme) {
3099
3088
return [ decl ( 'text-decoration-thickness' , value ) ]
3100
3089
}
3101
3090
default : {
3102
- value = asColor ( value , candidate . modifier , theme )
3091
+ value = asColor ( value , candidate . modifier )
3103
3092
if ( value === null ) return
3104
3093
3105
3094
return [ decl ( 'text-decoration-color' , value ) ]
@@ -3936,7 +3925,7 @@ export function createUtilities(theme: Theme) {
3936
3925
]
3937
3926
}
3938
3927
default : {
3939
- value = asColor ( value , candidate . modifier , theme )
3928
+ value = asColor ( value , candidate . modifier )
3940
3929
if ( value === null ) return
3941
3930
3942
3931
return [ decl ( 'outline-color' , value ) ]
@@ -4068,7 +4057,7 @@ export function createUtilities(theme: Theme) {
4068
4057
return [ decl ( 'font-size' , value ) ]
4069
4058
}
4070
4059
default : {
4071
- value = asColor ( value , candidate . modifier , theme )
4060
+ value = asColor ( value , candidate . modifier )
4072
4061
if ( value === null ) return
4073
4062
4074
4063
return [ decl ( 'color' , value ) ]
@@ -4184,7 +4173,7 @@ export function createUtilities(theme: Theme) {
4184
4173
4185
4174
switch ( type ) {
4186
4175
case 'color' : {
4187
- value = asColor ( value , candidate . modifier , theme )
4176
+ value = asColor ( value , candidate . modifier )
4188
4177
if ( value === null ) return
4189
4178
4190
4179
return [
@@ -4280,7 +4269,7 @@ export function createUtilities(theme: Theme) {
4280
4269
4281
4270
switch ( type ) {
4282
4271
case 'color' : {
4283
- value = asColor ( value , candidate . modifier , theme )
4272
+ value = asColor ( value , candidate . modifier )
4284
4273
if ( value === null ) return
4285
4274
4286
4275
return [
@@ -4392,7 +4381,7 @@ export function createUtilities(theme: Theme) {
4392
4381
]
4393
4382
}
4394
4383
default : {
4395
- value = asColor ( value , candidate . modifier , theme )
4384
+ value = asColor ( value , candidate . modifier )
4396
4385
if ( value === null ) return
4397
4386
4398
4387
return [ decl ( '--tw-ring-color' , value ) ]
@@ -4468,7 +4457,7 @@ export function createUtilities(theme: Theme) {
4468
4457
]
4469
4458
}
4470
4459
default : {
4471
- value = asColor ( value , candidate . modifier , theme )
4460
+ value = asColor ( value , candidate . modifier )
4472
4461
if ( value === null ) return
4473
4462
4474
4463
return [ decl ( '--tw-inset-ring-color' , value ) ]
@@ -4533,7 +4522,7 @@ export function createUtilities(theme: Theme) {
4533
4522
]
4534
4523
}
4535
4524
default : {
4536
- value = asColor ( value , candidate . modifier , theme )
4525
+ value = asColor ( value , candidate . modifier )
4537
4526
if ( value === null ) return
4538
4527
4539
4528
return [ decl ( '--tw-ring-offset-color' , value ) ]
0 commit comments