From 4872c9015dde6b9ec796d635663c17f1c138d809 Mon Sep 17 00:00:00 2001 From: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:37:12 -0400 Subject: [PATCH 1/2] Fallback to static chevron color if theme is using variables --- src/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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`, From a416c5490408a227ecfb0b4d48e370554ec436a6 Mon Sep 17 00:00:00 2001 From: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:44:22 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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