replaceAlpha() — tailwindcss Function Reference
Architecture documentation for the replaceAlpha() function in utilities.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD b7205c5d_8a1a_a50a_229f_7133a6a9c980["replaceAlpha()"] 537db6f9_ffa5_12bf_0cec_283e545c7822["alphaReplacedShadowProperties()"] 537db6f9_ffa5_12bf_0cec_283e545c7822 -->|calls| b7205c5d_8a1a_a50a_229f_7133a6a9c980 f82aa221_959b_12a7_fef5_44d13694b11e["alphaReplacedDropShadowProperties()"] f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| b7205c5d_8a1a_a50a_229f_7133a6a9c980 style b7205c5d_8a1a_a50a_229f_7133a6a9c980 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/utilities.ts lines 195–205
export function replaceAlpha(value: string, alpha: string): string {
// Convert numeric values (like `0.5`) to percentages (like `50%`) so they
// work properly with `color-mix`. Assume anything that isn't a number is
// safe to pass through as-is, like `var(--my-opacity)`.
let alphaAsNumber = Number(alpha)
if (!Number.isNaN(alphaAsNumber)) {
alpha = `${alphaAsNumber * 100}%`
}
return `oklab(from ${value} l a b / ${alpha})`
}
Domain
Subdomains
Source
Frequently Asked Questions
What does replaceAlpha() do?
replaceAlpha() is a function in the tailwindcss codebase.
What calls replaceAlpha()?
replaceAlpha() is called by 2 function(s): alphaReplacedDropShadowProperties, alphaReplacedShadowProperties.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free