alphaReplacedShadowProperties() — tailwindcss Function Reference
Architecture documentation for the alphaReplacedShadowProperties() function in utilities.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 7829d740_b77d_642a_6961_2b062dc27460["alphaReplacedShadowProperties()"] a71313ee_9751_a814_644d_8bed22215dfc["replaceShadowColors()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| a71313ee_9751_a814_644d_8bed22215dfc bf187488_02a1_3fac_d926_9593a941af2d["withAlpha()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| bf187488_02a1_3fac_d926_9593a941af2d 7f9cdd8b_d232_6558_6182_eead52aa2507["replaceAlpha()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| 7f9cdd8b_d232_6558_6182_eead52aa2507 2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66 85b46de2_edfa_9371_e2c6_e60f3f5346a2["decl()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| 85b46de2_edfa_9371_e2c6_e60f3f5346a2 08f33202_11d1_569a_e8df_de23eb987e2f["rule()"] 7829d740_b77d_642a_6961_2b062dc27460 -->|calls| 08f33202_11d1_569a_e8df_de23eb987e2f style 7829d740_b77d_642a_6961_2b062dc27460 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/utilities.ts lines 6447–6491
function alphaReplacedShadowProperties(
property: string,
value: string,
alpha: string | null | undefined,
varInjector: (color: string) => string,
prefix: string = '',
): AstNode[] {
let requiresFallback = false
let replacedValue = replaceShadowColors(value, (color) => {
if (alpha == null) {
return varInjector(color)
}
// When the input is currentcolor, we use our existing `color-mix(…)` approach to increase
// browser support. Note that the fallback of this is handled more generically in
// post-processing.
if (color.startsWith('current')) {
return varInjector(withAlpha(color, alpha))
}
// If any dynamic values are needed for the relative color syntax, we need to insert a
// replacement as lightningcss won't be able to resolve them statically.
if (color.startsWith('var(') || alpha.startsWith('var(')) {
requiresFallback = true
}
return varInjector(replaceAlpha(color, alpha))
})
function applyPrefix(x: string) {
if (!prefix) return x
return segment(x, ',')
.map((value) => prefix.trim() + ' ' + value.trim())
.join(', ')
}
if (requiresFallback) {
return [
decl(property, applyPrefix(replaceShadowColors(value, varInjector))),
rule('@supports (color: lab(from red l a b))', [decl(property, applyPrefix(replacedValue))]),
]
} else {
return [decl(property, applyPrefix(replacedValue))]
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does alphaReplacedShadowProperties() do?
alphaReplacedShadowProperties() is a function in the tailwindcss codebase.
What does alphaReplacedShadowProperties() call?
alphaReplacedShadowProperties() calls 6 function(s): decl, replaceAlpha, replaceShadowColors, rule, segment, withAlpha.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free