Skip to content

fix: preserve opacity values in multiple shadows using color-mix#19819

Open
buyuan-dev wants to merge 3 commits intotailwindlabs:mainfrom
buyuan-dev:fix/issue-19817
Open

fix: preserve opacity values in multiple shadows using color-mix#19819
buyuan-dev wants to merge 3 commits intotailwindlabs:mainfrom
buyuan-dev:fix/issue-19817

Conversation

@buyuan-dev
Copy link

Summary

Fixes an issue where opacity values were lost when using multiple shadows with different opacity levels. The fix uses color-mix(in srgb, ...) to properly preserve individual opacity values while still allowing shadow color customization via --tw-shadow-color.

Changes

  • Modified replaceShadowColors utility to detect alpha channels in shadow colors
  • When a shadow color has an alpha channel (e.g., rgba(0 0 0 / 0.12)), the fix extracts the alpha and wraps the color replacement in color-mix(in srgb, transparent, <color> <alpha>) format
  • This preserves individual opacity percentages for each shadow in multi-shadow definitions
  • Maintains backward compatibility with single-shadow use cases and colors without alpha

Testing

  • Tested with the reproduction case from the issue
  • Verified multiple shadows with different opacities render correctly
  • The fix correctly handles:
    • Modern rgba/hsla syntax with slash (rgba(0 0 0 / 0.12))
    • Legacy rgba/hsla syntax with comma (rgba(0, 0, 0, 0.12))
    • Colors without alpha (hex, named colors)
    • Modifier-based alpha replacement (shadow/50)

Fixes #19817

@buyuan-dev buyuan-dev requested a review from a team as a code owner March 18, 2026 02:43
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Walkthrough

The shadow color replacement utility was extended with helpers to extract alpha (extractAlpha), remove alpha (stripAlpha), and detect alpha-aware replacements (hasAlphaHandling). replaceShadowColors now computes a base color without alpha, calls the replacer with that base, and—when the original color had alpha and the replacement lacks alpha handling—wraps the result with color-mix(in srgb, transparent, <replacement> <alpha>). Prior behavior is retained for segments where offsets or colors cannot be reliably parsed. A suite of tests was added covering rgba/hsla variants, percentage alphas, multiple shadows, and modifier interactions.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main fix: preserving opacity values in multiple shadows using color-mix, which aligns with the primary objective.
Description check ✅ Passed The PR description accurately explains the problem, solution, and testing approach, detailing how alpha channels are handled and maintained in shadow definitions.
Linked Issues check ✅ Passed The code changes successfully address issue #19817 by implementing alpha extraction and color-mix wrapping to preserve individual shadow opacities across multiple shadows with different alpha values.
Out of Scope Changes check ✅ Passed All changes are directly focused on fixing the shadow color opacity preservation issue; no unrelated or out-of-scope modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/tailwindcss/src/utils/replace-shadow-colors.ts (1)

123-124: Consider using in oklab for consistency with withAlpha.

The existing withAlpha function in utilities.ts uses color-mix(in oklab, ...) for perceptually uniform blending. Using in srgb here may produce subtly different blending results. Consider aligning with the existing pattern unless there's a specific reason to prefer sRGB.

♻️ Suggested change
-      replacementColor = `color-mix(in srgb, transparent, ${replacementColor} ${alpha})`
+      replacementColor = `color-mix(in oklab, transparent, ${replacementColor} ${alpha})`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts` around lines 123 -
124, Change the color-mix space from "in srgb" to "in oklab" when constructing
replacementColor with alpha in replace-shadow-colors.ts so it matches the
perceptual blending used by withAlpha in utilities.ts; specifically update the
branch that sets replacementColor = `color-mix(in srgb, transparent,
${replacementColor} ${alpha})` to use `in oklab` instead, preserving the same
template and alpha handling and only altering the color space identifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts`:
- Around line 28-38: The legacy comma-alpha detection (/,\s*([\d.]+)\s*\)/)
incorrectly captures any trailing numeric component; update the logic in
replace-shadow-colors to only treat comma syntax as an alpha when the color
function is explicitly rgba or hsla and there are four comma-separated
components: first check that the string starts with "rgba(" or "hsla(" (e.g.,
color.startsWith("rgba(") || color.startsWith("hsla(")), extract the
parenthesized contents, split by commas and trim, verify the resulting array has
length 4, then parse the fourth item as the alpha (replacing the current
commaAlphaMatch block that uses /,\s*([\d.]+)\s*\)/ with this stricter
validation before computing and returning the rounded percentage from alphaNum).
- Around line 58-64: The regex in replace-shadow-colors.ts is accidentally
matching non-alpha forms (rgb/hsl); update the pattern used for commaMatch to
require the alpha form (match only "rgba" or "hsla") and correctly capture the
color components before the final alpha value so rgb/hsl inputs are ignored;
specifically adjust the regex that defines commaMatch (and its subsequent use of
commaMatch[1] and commaMatch[2]) so it only matches /(rgba|hsla)\(...\)/i (or an
equivalent pattern that ensures the trailing alpha is present) and then return
the reconstructed color using the captured non-alpha values as before.

---

Nitpick comments:
In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts`:
- Around line 123-124: Change the color-mix space from "in srgb" to "in oklab"
when constructing replacementColor with alpha in replace-shadow-colors.ts so it
matches the perceptual blending used by withAlpha in utilities.ts; specifically
update the branch that sets replacementColor = `color-mix(in srgb, transparent,
${replacementColor} ${alpha})` to use `in oklab` instead, preserving the same
template and alpha handling and only altering the color space identifier.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 77f75b2a-daed-47bc-8ca8-9909b8d4a245

📥 Commits

Reviewing files that changed from the base of the PR and between f302fce and c5b84d8.

📒 Files selected for processing (1)
  • packages/tailwindcss/src/utils/replace-shadow-colors.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/tailwindcss/src/utils/replace-shadow-colors.test.ts (1)

74-79: Add a legacy comma hsla(...) test case for completeness.

You covered slash hsla(...), but not comma-form hsla(h, s, l, a). Since legacy syntax support is in scope, one explicit test would close that gap and prevent regressions.

Proposed test addition
+  it('should preserve alpha from hsla color with legacy syntax', () => {
+    let parsed = replaceShadowColors('hsla(0, 0%, 0%, 0.3) 0px 1px 2px', replacer)
+    expect(parsed).toMatchInlineSnapshot(
+      `"color-mix(in srgb, transparent, var(--tw-shadow-color, hsl(0, 0%, 0%)) 30%) 0px 1px 2px"`,
+    )
+  })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tailwindcss/src/utils/replace-shadow-colors.test.ts` around lines 74
- 79, Add a unit test to replace-shadow-colors.test.ts that covers the legacy
comma hsla(...) syntax: call replaceShadowColors with a comma-form color like
"hsla(0, 0%, 0%, 0.3) 0px 1px 2px" (using the existing replacer) and assert the
expected output mirrors the other hsla test (preserving alpha in color-mix with
var(--tw-shadow-color)). This ensures replaceShadowColors handles both slash and
legacy comma hsla formats.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/tailwindcss/src/utils/replace-shadow-colors.test.ts`:
- Around line 74-79: Add a unit test to replace-shadow-colors.test.ts that
covers the legacy comma hsla(...) syntax: call replaceShadowColors with a
comma-form color like "hsla(0, 0%, 0%, 0.3) 0px 1px 2px" (using the existing
replacer) and assert the expected output mirrors the other hsla test (preserving
alpha in color-mix with var(--tw-shadow-color)). This ensures
replaceShadowColors handles both slash and legacy comma hsla formats.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3c9a9e17-46c0-4ce7-b2ef-2c23f0a409d7

📥 Commits

Reviewing files that changed from the base of the PR and between c5b84d8 and 0a83e40.

📒 Files selected for processing (1)
  • packages/tailwindcss/src/utils/replace-shadow-colors.test.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts`:
- Around line 28-30: Restore the missing declaration for the regex match by
re-adding the const commaAlphaMatch =
color.match(/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i) so the
subsequent if (commaAlphaMatch) branch in replace-shadow-colors.ts can access
the parsed alpha; locate where commaAlphaMatch is currently referenced and
either uncomment or reinsert that exact declaration (using the same regex)
immediately before the if (commaAlphaMatch) check to fix the undefined
identifier and restore type-checking.
- Around line 10-23: extractAlpha() is using the wrong capture index for the
"slash" regex and stripAlpha() has a mismatched pattern so modern hsl/rgba with
unit tokens (like "deg") or legacy percentage alphas (e.g. "rgba(..., 12%)" /
"hsla(..., 30%)") are not handled consistently; update extractAlpha() to pull
the alpha from slashAlphaMatch[3] (the third capture in
/^(rgba?|hsla?)\((.+)\s*\/\s*([\d.]+%?)\s*\)$/i) and normalize it to a percent
as currently done, and modify stripAlpha() to accept unit-containing color
components (allow letters like "deg" and % in the middle capture) and also
detect legacy comma-separated alpha including percentage values so that both
extractAlpha() and stripAlpha() produce matching base-color and alpha values
used by replacement().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cc8d43fd-5274-44e0-8f10-6a888ee9c7ca

📥 Commits

Reviewing files that changed from the base of the PR and between 0a83e40 and db6d0e1.

📒 Files selected for processing (1)
  • packages/tailwindcss/src/utils/replace-shadow-colors.ts

Comment on lines +10 to +23
function extractAlpha(color: string): string | null {
// Modern rgba/hsla syntax with slash: rgba(0 0 0 / 0.12) or rgba(0 0 0 / 12%)
const slashAlphaMatch = color.match(/\/\s*([\d.]+)%?\s*\)/)
if (slashAlphaMatch) {
let alpha = slashAlphaMatch[1]
// If it's already a percentage, return it
if (slashAlphaMatch[0].includes('%')) {
return `${alpha}%`
}
// Convert decimal to percentage
const alphaNum = parseFloat(alpha)
if (!isNaN(alphaNum)) {
// Round to avoid floating point precision issues
return `${Math.round(alphaNum * 100)}%`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "replace-shadow-colors.ts" | head -20

Repository: tailwindlabs/tailwindcss

Length of output: 125


🏁 Script executed:

cat -n ./packages/tailwindcss/src/utils/replace-shadow-colors.ts

Repository: tailwindlabs/tailwindcss

Length of output: 5588


🏁 Script executed:

# Test the actual regex patterns with concrete examples to fully verify
python3 << 'EOF'
import re

# Test case 1: hsl with deg units and slash alpha
test_color_1 = "hsl(180deg 50% 50% / 0.3)"

# Current extractAlpha slash pattern
extract_slash_current = r"/\s*([\d.]+)%?\s*\)"
match = re.search(extract_slash_current, test_color_1)
print(f"extractAlpha current pattern on '{test_color_1}': {bool(match)}")
if match:
    print(f"  Captured groups: {match.groups()}")

# Current stripAlpha slash pattern
strip_slash_current = r"^(rgba?|hsla?)\(([\d\s.%]+)\s*\/\s*[\d.]+%?\s*\)$"
match = re.search(strip_slash_current, test_color_1, re.IGNORECASE)
print(f"stripAlpha current pattern on '{test_color_1}': {bool(match)}")

# Test case 2: rgba with percentage alpha (comma form)
test_color_2 = "rgba(0, 0, 0, 12%)"

# Current extractAlpha comma pattern
extract_comma_current = r"^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$"
match = re.search(extract_comma_current, test_color_2, re.IGNORECASE)
print(f"\nextractAlpha current pattern on '{test_color_2}': {bool(match)}")

# Test case 3: Standard rgba with decimal alpha (comma form) - should work
test_color_3 = "rgba(0, 0, 0, 0.12)"
match = re.search(extract_comma_current, test_color_3, re.IGNORECASE)
print(f"extractAlpha current pattern on '{test_color_3}': {bool(match)}")
if match:
    print(f"  Captured groups: {match.groups()}")

# Test case 4: stripAlpha with percentage comma alpha
test_color_2 = "rgba(0, 0, 0, 12%)"
strip_comma_current = r"^(rgba?|hsla?)\(([\d\s.,%]+),\s*[\d.]+\s*\)$"
match = re.search(strip_comma_current, test_color_2, re.IGNORECASE)
print(f"stripAlpha current pattern on '{test_color_2}': {bool(match)}")

# Test case 5: stripAlpha with decimal comma alpha - should work
test_color_3 = "rgba(0, 0, 0, 0.12)"
match = re.search(strip_comma_current, test_color_3, re.IGNORECASE)
print(f"stripAlpha current pattern on '{test_color_3}': {bool(match)}")
if match:
    print(f"  Captured groups: {match.groups()}")
EOF

Repository: tailwindlabs/tailwindcss

Length of output: 531


🏁 Script executed:

# Verify the proposed fix patterns work correctly
python3 << 'EOF'
import re

test_cases = [
    ("hsl(180deg 50% 50% / 0.3)", True, "modern hsl with deg and decimal alpha"),
    ("rgb(0 0 0 / 0.12)", True, "modern rgb with decimal alpha"),
    ("rgba(255 128 64 / 30%)", True, "modern rgba with percentage alpha"),
    ("hsla(180deg 50% 50% / 0.3)", True, "modern hsla with deg and decimal alpha"),
    ("rgba(0, 0, 0, 0.12)", True, "legacy rgba with decimal alpha"),
    ("rgba(0, 0, 0, 12%)", True, "legacy rgba with percentage alpha"),
    ("hsla(180, 50%, 50%, 0.3)", True, "legacy hsla with decimal alpha"),
    ("hsla(180, 50%, 50%, 30%)", True, "legacy hsla with percentage alpha"),
    ("rgb(0 0 0)", False, "no alpha"),
    ("currentcolor", False, "not a function"),
]

print("=" * 80)
print("PROPOSED extractAlpha PATTERNS")
print("=" * 80)

# Proposed slash pattern from diff
proposed_slash = r"^(rgba?|hsla?)\((.+)\s*\/\s*([\d.]+%?)\s*\)$"

print(f"\nSlash pattern: {proposed_slash}")
print("-" * 80)

for color, should_match, desc in test_cases:
    if '/' not in color:
        continue
    match = re.match(proposed_slash, color, re.IGNORECASE)
    status = "✓" if bool(match) == should_match else "✗"
    print(f"{status} '{color}'")
    print(f"  Expected: {should_match}, Got: {bool(match)} ({desc})")
    if match:
        print(f"  Groups: func={match.group(1)}, values={match.group(2)}, alpha={match.group(3)}")

# Proposed comma pattern from diff
proposed_comma = r"^(?:rgba|hsla)\(([^,]+,[^,]+,[^,]+),\s*([\d.]+%?)\s*\)$"

print(f"\n\nComma pattern: {proposed_comma}")
print("-" * 80)

for color, should_match, desc in test_cases:
    if ',' not in color:
        continue
    match = re.match(proposed_comma, color, re.IGNORECASE)
    status = "✓" if bool(match) == should_match else "✗"
    print(f"{status} '{color}'")
    print(f"  Expected: {should_match}, Got: {bool(match)} ({desc})")
    if match:
        print(f"  Groups: values={match.group(1)}, alpha={match.group(2)}")

print("\n" + "=" * 80)
print("PROPOSED stripAlpha PATTERNS")
print("=" * 80)

# Proposed stripAlpha slash pattern from diff
proposed_strip_slash = r"^(rgba?|hsla?)\((.+)\s*\/\s*[\d.]+%?\s*\)$"

print(f"\nSlash pattern: {proposed_strip_slash}")
print("-" * 80)

strip_test_cases = [
    ("hsl(180deg 50% 50% / 0.3)", "hsl(180deg 50% 50% )", "modern hsl with deg"),
    ("rgb(0 0 0 / 0.12)", "rgb(0 0 0)", "modern rgb"),
    ("rgba(0, 0, 0, 0.12)", None, "legacy - handled by comma pattern"),
]

for color, expected_result, desc in strip_test_cases:
    if '/' not in color:
        continue
    match = re.match(proposed_strip_slash, color, re.IGNORECASE)
    status = "✓" if bool(match) else "✗"
    print(f"{status} '{color}' ({desc})")
    if match:
        func_type = match.group(1).lower().replace('a', '')
        values = match.group(2).strip()
        result = f"{func_type}({values})"
        print(f"  Result: '{result}'")

# Proposed stripAlpha comma pattern from diff
proposed_strip_comma = r"^(rgba|hsla)\(([^,]+,[^,]+,[^,]+),\s*[\d.]+%?\s*\)$"

print(f"\nComma pattern: {proposed_strip_comma}")
print("-" * 80)

comma_strip_test = [
    ("rgba(0, 0, 0, 0.12)", "rgb(0, 0, 0)"),
    ("rgba(0, 0, 0, 12%)", "rgb(0, 0, 0)"),
    ("hsla(180, 50%, 50%, 0.3)", "hsl(180, 50%, 50%)"),
]

for color, expected_result in comma_strip_test:
    match = re.match(proposed_strip_comma, color, re.IGNORECASE)
    status = "✓" if bool(match) else "✗"
    print(f"{status} '{color}'")
    if match:
        func_type = match.group(1).lower().replace('a', '')
        values = match.group(2).strip()
        result = f"{func_type}({values})"
        print(f"  Result: '{result}'")

EOF

Repository: tailwindlabs/tailwindcss

Length of output: 2425


Fix regex mismatch between extractAlpha() and stripAlpha() for consistent color/alpha handling.

Current code has misaligned patterns that create color parsing failures:

  1. extractAlpha() matches hsl(180deg 50% 50% / 0.3) but stripAlpha() rejects it (character class [\d\s.%]+ excludes unit letters like deg), leaving / 0.3 in the base color passed to replacement().
  2. Neither function handles percentage alphas in legacy comma form: rgba(0, 0, 0, 12%) and hsla(..., 30%) are never extracted, so custom --tw-shadow-color overrides lose per-shadow opacity.

The proposed fix patterns are correct, but the diff contains a group index error: the slash pattern /^(rgba?|hsla?)\((.+)\s*\/\s*([\d.]+%?)\s*\)$/i captures alpha in group [3], not [2] as shown in the diff. Correct the assignment to slashAlphaMatch[3] and apply the corresponding fixes to stripAlpha() to handle both modern (slash) and legacy (comma) syntax consistently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts` around lines 10 -
23, extractAlpha() is using the wrong capture index for the "slash" regex and
stripAlpha() has a mismatched pattern so modern hsl/rgba with unit tokens (like
"deg") or legacy percentage alphas (e.g. "rgba(..., 12%)" / "hsla(..., 30%)")
are not handled consistently; update extractAlpha() to pull the alpha from
slashAlphaMatch[3] (the third capture in
/^(rgba?|hsla?)\((.+)\s*\/\s*([\d.]+%?)\s*\)$/i) and normalize it to a percent
as currently done, and modify stripAlpha() to accept unit-containing color
components (allow letters like "deg" and % in the middle capture) and also
detect legacy comma-separated alpha including percentage values so that both
extractAlpha() and stripAlpha() produce matching base-color and alpha values
used by replacement().

Comment on lines +28 to +30
// Legacy rgba/hsla syntax with comma: rgba(0, 0, 0, 0.12)
// Must be rgba/hsla (with 'a') to have 4 values where the last is alpha`n const commaAlphaMatch = color.match(/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i)
if (commaAlphaMatch) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat -n packages/tailwindcss/src/utils/replace-shadow-colors.ts | sed -n '25,35p'

Repository: tailwindlabs/tailwindcss

Length of output: 627


🏁 Script executed:

rg "commaAlphaMatch" packages/tailwindcss/src/utils/replace-shadow-colors.ts

Repository: tailwindlabs/tailwindcss

Length of output: 299


🏁 Script executed:

cd packages/tailwindcss && [ -f tsconfig.json ] && cat tsconfig.json || echo "No tsconfig.json found"

Repository: tailwindlabs/tailwindcss

Length of output: 109


Restore the commaAlphaMatch declaration to code.

The const commaAlphaMatch = ... declaration on line 29 is inside the // comment, making it unreachable. Line 30 references an undefined identifier and the file fails type-checking.

🐛 Proposed fix
   // Legacy rgba/hsla syntax with comma: rgba(0, 0, 0, 0.12)
-  // Must be rgba/hsla (with 'a') to have 4 values where the last is alpha`n  const commaAlphaMatch = color.match(/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i)
+  // Must be rgba/hsla (with 'a') to have 4 values where the last is alpha.
+  const commaAlphaMatch = color.match(
+    /^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i,
+  )
   if (commaAlphaMatch) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Legacy rgba/hsla syntax with comma: rgba(0, 0, 0, 0.12)
// Must be rgba/hsla (with 'a') to have 4 values where the last is alpha`n const commaAlphaMatch = color.match(/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i)
if (commaAlphaMatch) {
// Legacy rgba/hsla syntax with comma: rgba(0, 0, 0, 0.12)
// Must be rgba/hsla (with 'a') to have 4 values where the last is alpha.
const commaAlphaMatch = color.match(
/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i,
)
if (commaAlphaMatch) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tailwindcss/src/utils/replace-shadow-colors.ts` around lines 28 -
30, Restore the missing declaration for the regex match by re-adding the const
commaAlphaMatch =
color.match(/^(?:rgba|hsla)\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\s*\)$/i) so the
subsequent if (commaAlphaMatch) branch in replace-shadow-colors.ts can access
the parsed alpha; locate where commaAlphaMatch is currently referenced and
either uncomment or reinsert that exact declaration (using the same regex)
immediately before the if (commaAlphaMatch) check to fix the undefined
identifier and restore type-checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shadow color and multiple shadows

1 participant