@@ -129,24 +129,13 @@ export function withAlpha(value: string, alpha: string): string {
129129/**
130130 * Resolve a color value + optional opacity modifier to a final color.
131131 */
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 {
137133 if ( ! modifier ) return value
138134
139135 if ( modifier . kind === 'arbitrary' ) {
140136 return withAlpha ( value , modifier . value )
141137 }
142138
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-
150139 if ( Number . isNaN ( Number ( modifier . value ) ) ) {
151140 return null
152141 }
@@ -208,7 +197,7 @@ function resolveThemeColor<T extends ColorThemeKey>(
208197 }
209198 }
210199
211- return value ? asColor ( value , candidate . modifier , theme ) : null
200+ return value ? asColor ( value , candidate . modifier ) : null
212201}
213202
214203export function createUtilities ( theme : Theme ) {
@@ -360,7 +349,7 @@ export function createUtilities(theme: Theme) {
360349 value = candidate . value . value
361350
362351 // Apply an opacity modifier to the value if appropriate.
363- value = asColor ( value , candidate . modifier , theme )
352+ value = asColor ( value , candidate . modifier )
364353 } else {
365354 value = resolveThemeColor ( candidate , theme , desc . themeKeys )
366355 }
@@ -2241,7 +2230,7 @@ export function createUtilities(theme: Theme) {
22412230 return [ borderProperties ( ) , ...decls ]
22422231 }
22432232 default : {
2244- value = asColor ( value , candidate . modifier , theme )
2233+ value = asColor ( value , candidate . modifier )
22452234 if ( value === null ) return
22462235
22472236 return desc . color ( value )
@@ -2549,7 +2538,7 @@ export function createUtilities(theme: Theme) {
25492538 return [ decl ( 'background-image' , value ) ]
25502539 }
25512540 default : {
2552- value = asColor ( value , candidate . modifier , theme )
2541+ value = asColor ( value , candidate . modifier )
25532542 if ( value === null ) return
25542543
25552544 return [ decl ( 'background-color' , value ) ]
@@ -2625,7 +2614,7 @@ export function createUtilities(theme: Theme) {
26252614 return desc . position ( value )
26262615 }
26272616 default : {
2628- value = asColor ( value , candidate . modifier , theme )
2617+ value = asColor ( value , candidate . modifier )
26292618 if ( value === null ) return
26302619
26312620 return desc . color ( value )
@@ -2763,7 +2752,7 @@ export function createUtilities(theme: Theme) {
27632752 if ( candidate . negative || ! candidate . value ) return
27642753
27652754 if ( candidate . value . kind === 'arbitrary' ) {
2766- let value = asColor ( candidate . value . value , candidate . modifier , theme )
2755+ let value = asColor ( candidate . value . value , candidate . modifier )
27672756 if ( value === null ) return
27682757 return [ decl ( 'fill' , value ) ]
27692758 }
@@ -2801,7 +2790,7 @@ export function createUtilities(theme: Theme) {
28012790 return [ decl ( 'stroke-width' , value ) ]
28022791 }
28032792 default : {
2804- value = asColor ( candidate . value . value , candidate . modifier , theme )
2793+ value = asColor ( candidate . value . value , candidate . modifier )
28052794 if ( value === null ) return
28062795
28072796 return [ decl ( 'stroke' , value ) ]
@@ -3099,7 +3088,7 @@ export function createUtilities(theme: Theme) {
30993088 return [ decl ( 'text-decoration-thickness' , value ) ]
31003089 }
31013090 default : {
3102- value = asColor ( value , candidate . modifier , theme )
3091+ value = asColor ( value , candidate . modifier )
31033092 if ( value === null ) return
31043093
31053094 return [ decl ( 'text-decoration-color' , value ) ]
@@ -3936,7 +3925,7 @@ export function createUtilities(theme: Theme) {
39363925 ]
39373926 }
39383927 default : {
3939- value = asColor ( value , candidate . modifier , theme )
3928+ value = asColor ( value , candidate . modifier )
39403929 if ( value === null ) return
39413930
39423931 return [ decl ( 'outline-color' , value ) ]
@@ -4068,7 +4057,7 @@ export function createUtilities(theme: Theme) {
40684057 return [ decl ( 'font-size' , value ) ]
40694058 }
40704059 default : {
4071- value = asColor ( value , candidate . modifier , theme )
4060+ value = asColor ( value , candidate . modifier )
40724061 if ( value === null ) return
40734062
40744063 return [ decl ( 'color' , value ) ]
@@ -4184,7 +4173,7 @@ export function createUtilities(theme: Theme) {
41844173
41854174 switch ( type ) {
41864175 case 'color' : {
4187- value = asColor ( value , candidate . modifier , theme )
4176+ value = asColor ( value , candidate . modifier )
41884177 if ( value === null ) return
41894178
41904179 return [
@@ -4280,7 +4269,7 @@ export function createUtilities(theme: Theme) {
42804269
42814270 switch ( type ) {
42824271 case 'color' : {
4283- value = asColor ( value , candidate . modifier , theme )
4272+ value = asColor ( value , candidate . modifier )
42844273 if ( value === null ) return
42854274
42864275 return [
@@ -4392,7 +4381,7 @@ export function createUtilities(theme: Theme) {
43924381 ]
43934382 }
43944383 default : {
4395- value = asColor ( value , candidate . modifier , theme )
4384+ value = asColor ( value , candidate . modifier )
43964385 if ( value === null ) return
43974386
43984387 return [ decl ( '--tw-ring-color' , value ) ]
@@ -4468,7 +4457,7 @@ export function createUtilities(theme: Theme) {
44684457 ]
44694458 }
44704459 default : {
4471- value = asColor ( value , candidate . modifier , theme )
4460+ value = asColor ( value , candidate . modifier )
44724461 if ( value === null ) return
44734462
44744463 return [ decl ( '--tw-inset-ring-color' , value ) ]
@@ -4533,7 +4522,7 @@ export function createUtilities(theme: Theme) {
45334522 ]
45344523 }
45354524 default : {
4536- value = asColor ( value , candidate . modifier , theme )
4525+ value = asColor ( value , candidate . modifier )
45374526 if ( value === null ) return
45384527
45394528 return [ decl ( '--tw-ring-offset-color' , value ) ]
0 commit comments