File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ Unreleased]
9
9
10
- - Nothing yet!
10
+ ### Fixed
11
+
12
+ - Fallback to static chevron color if theme is using variables ([ #167 ] ( https://github.com/tailwindlabs/tailwindcss-forms/pull/167 ) )
11
13
12
14
## [ 0.5.8] - 2024-08-28
13
15
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ function resolveColor(color, opacityVariableName) {
11
11
12
12
const forms = plugin . withOptions ( function ( options = { strategy : undefined } ) {
13
13
return function ( { addBase, addComponents, theme } ) {
14
+ function resolveChevronColor ( color , fallback ) {
15
+ let resolved = theme ( color )
16
+
17
+ if ( ! resolved || resolved . includes ( 'var(' ) ) {
18
+ return fallback
19
+ }
20
+
21
+ return resolved . replace ( '<alpha-value>' , '1' )
22
+ }
23
+
14
24
const strategy = options . strategy === undefined ? [ 'base' , 'class' ] : [ options . strategy ]
15
25
16
26
const rules = [
@@ -153,9 +163,9 @@ const forms = plugin.withOptions(function (options = { strategy: undefined }) {
153
163
class : [ '.form-select' ] ,
154
164
styles : {
155
165
'background-image' : `url("${ svgToDataUri (
156
- `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="${ resolveColor (
157
- theme ( 'colors.gray.500' , colors . gray [ 500 ] ) ,
158
- '--tw-stroke-opacity'
166
+ `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="${ resolveChevronColor (
167
+ 'colors.gray.500' ,
168
+ colors . gray [ 500 ]
159
169
) } " stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 8l4 4 4-4"/></svg>`
160
170
) } ")`,
161
171
'background-position' : `right ${ spacing [ 2 ] } center` ,
You can’t perform that action at this time.
0 commit comments