MCPcopy
hub / github.com/tailwindlabs/tailwindcss / alpha

Function alpha

packages/tailwindcss/src/css-functions.ts:20–41  ·  view source on GitHub ↗
(
  _designSystem: DesignSystem,
  _source: AstNode,
  value: string,
  ...rest: string[]
)

Source from the content-addressed store, hash-verified

18}
19
20function alpha(
21 _designSystem: DesignSystem,
22 _source: AstNode,
23 value: string,
24 ...rest: string[]
25): string {
26 let [color, alpha] = segment(value, '/').map((v) => v.trim())
27
28 if (!color || !alpha) {
29 throw new Error(
30 `The --alpha(…) function requires a color and an alpha value, e.g.: \`--alpha(${color || 'var(--my-color)'} / ${alpha || '50%'})\``,
31 )
32 }
33
34 if (rest.length > 0) {
35 throw new Error(
36 `The --alpha(…) function only accepts one argument, e.g.: \`--alpha(${color || 'var(--my-color)'} / ${alpha || '50%'})\``,
37 )
38 }
39
40 return withAlpha(color, alpha)
41}
42
43function spacing(
44 designSystem: DesignSystem,

Callers

nothing calls this directly

Calls 2

segmentFunction · 0.90
withAlphaFunction · 0.90

Tested by

no test coverage detected