@@ -110,6 +110,103 @@ test('per-plugin colors with the same key can differ when using a custom colors
110110 } )
111111} )
112112
113+ test ( 'default ring color can be a function' , ( ) => {
114+ function color ( variable ) {
115+ return function ( { opacityVariable, opacityValue } ) {
116+ if ( opacityValue !== undefined ) {
117+ return `rgba(${ variable } , ${ opacityValue } )`
118+ }
119+ if ( opacityVariable !== undefined ) {
120+ return `rgba(${ variable } , var(${ opacityVariable } , 1))`
121+ }
122+ return `rgb(${ variable } )`
123+ }
124+ }
125+
126+ let config = {
127+ content : [
128+ {
129+ raw : html ` <div class= "ring" > </ div> ` ,
130+ } ,
131+ ] ,
132+
133+ theme : {
134+ extend : {
135+ ringColor : {
136+ DEFAULT : color ( 'var(--red)' ) ,
137+ } ,
138+ } ,
139+ } ,
140+ plugins : [ ] ,
141+ corePlugins : { preflight : false } ,
142+ }
143+
144+ let input = css `
145+ @tailwind base;
146+ @tailwind components;
147+ @tailwind utilities;
148+ `
149+
150+ return run ( input , config ) . then ( ( result ) => {
151+ expect ( result . css ) . toMatchFormattedCss ( css `
152+ * ,
153+ ::before ,
154+ ::after {
155+ --tw-translate-x : 0 ;
156+ --tw-translate-y : 0 ;
157+ --tw-rotate : 0 ;
158+ --tw-skew-x : 0 ;
159+ --tw-skew-y : 0 ;
160+ --tw-scale-x : 1 ;
161+ --tw-scale-y : 1 ;
162+ --tw-pan-x : ;
163+ --tw-pan-y : ;
164+ --tw-pinch-zoom : ;
165+ --tw-scroll-snap-strictness : proximity;
166+ --tw-ordinal : ;
167+ --tw-slashed-zero : ;
168+ --tw-numeric-figure : ;
169+ --tw-numeric-spacing : ;
170+ --tw-numeric-fraction : ;
171+ --tw-ring-inset : ;
172+ --tw-ring-offset-width : 0px ;
173+ --tw-ring-offset-color : # fff ;
174+ --tw-ring-color : rgba (var (--red ), 0.5 );
175+ --tw-ring-offset-shadow : 0 0 # 0000 ;
176+ --tw-ring-shadow : 0 0 # 0000 ;
177+ --tw-shadow : 0 0 # 0000 ;
178+ --tw-shadow-colored : 0 0 # 0000 ;
179+ --tw-blur : ;
180+ --tw-brightness : ;
181+ --tw-contrast : ;
182+ --tw-grayscale : ;
183+ --tw-hue-rotate : ;
184+ --tw-invert : ;
185+ --tw-saturate : ;
186+ --tw-sepia : ;
187+ --tw-drop-shadow : ;
188+ --tw-backdrop-blur : ;
189+ --tw-backdrop-brightness : ;
190+ --tw-backdrop-contrast : ;
191+ --tw-backdrop-grayscale : ;
192+ --tw-backdrop-hue-rotate : ;
193+ --tw-backdrop-invert : ;
194+ --tw-backdrop-opacity : ;
195+ --tw-backdrop-saturate : ;
196+ --tw-backdrop-sepia : ;
197+ }
198+
199+ .ring {
200+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
201+ var (--tw-ring-offset-color );
202+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
203+ var (--tw-ring-color );
204+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
205+ }
206+ ` )
207+ } )
208+ } )
209+
113210it ( 'fasly config values still work' , ( ) => {
114211 let config = {
115212 content : [ { raw : html `<div class= "inset-0" > </ div> ` } ] ,
0 commit comments