File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 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
77
88## [ Unreleased]
99
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 ) )
1113
1214## [ 0.5.8] - 2024-08-28
1315
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ function resolveColor(color, opacityVariableName) {
1111
1212const forms = plugin . withOptions ( function ( options = { strategy : undefined } ) {
1313 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+
1424 const strategy = options . strategy === undefined ? [ 'base' , 'class' ] : [ options . strategy ]
1525
1626 const rules = [
@@ -153,9 +163,9 @@ const forms = plugin.withOptions(function (options = { strategy: undefined }) {
153163 class : [ '.form-select' ] ,
154164 styles : {
155165 '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 ]
159169 ) } " stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 8l4 4 4-4"/></svg>`
160170 ) } ")`,
161171 'background-position' : `right ${ spacing [ 2 ] } center` ,
You can’t perform that action at this time.
0 commit comments