diff --git a/CHANGELOG.md b/CHANGELOG.md index eddb2cb..2daa906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Fallback to static chevron color if theme is using variables ([#167](https://github.com/tailwindlabs/tailwindcss-forms/pull/167)) ## [0.5.8] - 2024-08-28 diff --git a/src/index.js b/src/index.js index dd2953f..b86a224 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,16 @@ function resolveColor(color, opacityVariableName) { const forms = plugin.withOptions(function (options = { strategy: undefined }) { return function ({ addBase, addComponents, theme }) { + function resolveChevronColor(color, fallback) { + let resolved = theme(color) + + if (!resolved || resolved.includes('var(')) { + return fallback + } + + return resolved.replace('', '1') + } + const strategy = options.strategy === undefined ? ['base', 'class'] : [options.strategy] const rules = [ @@ -153,9 +163,9 @@ const forms = plugin.withOptions(function (options = { strategy: undefined }) { class: ['.form-select'], styles: { 'background-image': `url("${svgToDataUri( - `` )}")`, 'background-position': `right ${spacing[2]} center`,