@@ -69,8 +69,16 @@ describe(`colors`, () => {
6969
7070 test ( `rgb/a configged colors` , ( ) => {
7171 tw = create ( {
72- theme : { colors : { foo : `rgb(1, 2, 3)` , bar : `rgba(4, 5, 6, 0.5)` } } ,
72+ theme : {
73+ colors : {
74+ foo : `rgb(1, 2, 3)` ,
75+ bar : `rgba(4, 5, 6, 0.5)` ,
76+ fizz : `rgb(7 8 9)` ,
77+ buzz : `rgba(10 11 12 / 0.6)` ,
78+ } ,
79+ } ,
7380 } ) ;
81+
7482 expect ( tw `text-foo bg-bar` ) . toEqual ( {
7583 color : `rgb(1, 2, 3)` ,
7684 backgroundColor : `rgba(4, 5, 6, 0.5)` ,
@@ -79,6 +87,66 @@ describe(`colors`, () => {
7987 expect ( tw `text-foo text-opacity-75` ) . toEqual ( {
8088 color : `rgba(1, 2, 3, 0.75)` ,
8189 } ) ;
90+
91+ expect ( tw `text-foo/50 bg-bar/75` ) . toEqual ( {
92+ color : `rgba(1, 2, 3, 0.5)` ,
93+ backgroundColor : `rgba(4, 5, 6, 0.75)` ,
94+ } ) ;
95+
96+ expect ( tw `text-fizz bg-buzz` ) . toEqual ( {
97+ color : `rgb(7 8 9)` ,
98+ backgroundColor : `rgba(10 11 12 / 0.6)` ,
99+ } ) ;
100+
101+ expect ( tw `text-fizz text-opacity-75` ) . toEqual ( {
102+ color : `rgba(7 8 9 / 0.75)` ,
103+ } ) ;
104+
105+ expect ( tw `text-fizz/50 bg-buzz/75` ) . toEqual ( {
106+ color : `rgba(7 8 9 / 0.5)` ,
107+ backgroundColor : `rgba(10 11 12 / 0.75)` ,
108+ } ) ;
109+ } ) ;
110+
111+ test ( `hsl/a configged colors` , ( ) => {
112+ tw = create ( {
113+ theme : {
114+ colors : {
115+ foo : `hsl(1, 2%, 3%)` ,
116+ bar : `hsla(4, 5%, 6%, 0.5)` ,
117+ fizz : `hsl(7 8% 9%)` ,
118+ buzz : `hsla(10 11% 12% / 0.6)` ,
119+ } ,
120+ } ,
121+ } ) ;
122+
123+ expect ( tw `text-foo bg-bar` ) . toEqual ( {
124+ color : `hsl(1, 2%, 3%)` ,
125+ backgroundColor : `hsla(4, 5%, 6%, 0.5)` ,
126+ } ) ;
127+
128+ expect ( tw `text-foo text-opacity-75` ) . toEqual ( {
129+ color : `hsla(1, 2%, 3%, 0.75)` ,
130+ } ) ;
131+
132+ expect ( tw `text-foo/50 bg-bar/75` ) . toEqual ( {
133+ color : `hsla(1, 2%, 3%, 0.5)` ,
134+ backgroundColor : `hsla(4, 5%, 6%, 0.75)` ,
135+ } ) ;
136+
137+ expect ( tw `text-fizz bg-buzz` ) . toEqual ( {
138+ color : `hsl(7 8% 9%)` ,
139+ backgroundColor : `hsla(10 11% 12% / 0.6)` ,
140+ } ) ;
141+
142+ expect ( tw `text-fizz text-opacity-75` ) . toEqual ( {
143+ color : `hsla(7 8% 9% / 0.75)` ,
144+ } ) ;
145+
146+ expect ( tw `text-fizz/50 bg-buzz/75` ) . toEqual ( {
147+ color : `hsla(7 8% 9% / 0.5)` ,
148+ backgroundColor : `hsla(10 11% 12% / 0.75)` ,
149+ } ) ;
82150 } ) ;
83151
84152 test ( `DEFAULT special modifier` , ( ) => {
@@ -97,9 +165,19 @@ describe(`colors`, () => {
97165 expect ( tw `bg-[rgba(3,4,5,0.1)]` ) . toEqual ( {
98166 backgroundColor : `rgba(3,4,5,0.1)` ,
99167 } ) ;
168+ expect ( tw `bg-[hsla(6,7%,8%,0.2)]` ) . toEqual ( {
169+ backgroundColor : `hsla(6,7%,8%,0.2)` ,
170+ } ) ;
171+
100172 expect ( tw `bg-[#012] bg-opacity-50` ) . toEqual ( {
101173 backgroundColor : `rgba(0, 17, 34, 0.5)` ,
102174 } ) ;
175+ expect ( tw `bg-[rgba(3,4,5,0.1)] bg-opacity-50` ) . toEqual ( {
176+ backgroundColor : `rgba(3,4,5, 0.5)` ,
177+ } ) ;
178+ expect ( tw `bg-[hsla(6,7%,8%,0.2)] bg-opacity-50` ) . toEqual ( {
179+ backgroundColor : `hsla(6,7%,8%, 0.5)` ,
180+ } ) ;
103181 } ) ;
104182
105183 test ( `non-group dashed custom colors` , ( ) => {
0 commit comments