Home / Function/ legacyTheme() — tailwindcss Function Reference

legacyTheme() — tailwindcss Function Reference

Architecture documentation for the legacyTheme() function in css-functions.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  3ee77e11_8d52_723b_aade_ff424151c955["legacyTheme()"]
  1648a493_13b2_8170_f86b_607e088d9565["css-functions.ts"]
  3ee77e11_8d52_723b_aade_ff424151c955 -->|defined in| 1648a493_13b2_8170_f86b_607e088d9565
  f7084cdf_ec39_bdc5_f4a6_0ba7a2e6f038["eventuallyUnquote()"]
  3ee77e11_8d52_723b_aade_ff424151c955 -->|calls| f7084cdf_ec39_bdc5_f4a6_0ba7a2e6f038
  afa623bf_4f68_b25f_8bd7_1d00a4fcfe48["theme()"]
  3ee77e11_8d52_723b_aade_ff424151c955 -->|calls| afa623bf_4f68_b25f_8bd7_1d00a4fcfe48
  style 3ee77e11_8d52_723b_aade_ff424151c955 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/css-functions.ts lines 129–150

function legacyTheme(
  designSystem: DesignSystem,
  _source: AstNode,
  path: string,
  ...fallback: string[]
): string {
  path = eventuallyUnquote(path)

  let resolvedValue = designSystem.resolveThemeValue(path)

  if (!resolvedValue && fallback.length > 0) {
    return fallback.join(', ')
  }

  if (!resolvedValue) {
    throw new Error(
      `Could not resolve value for theme function: \`theme(${path})\`. Consider checking if the path is correct or provide a fallback value to silence this error.`,
    )
  }

  return resolvedValue
}

Domain

Subdomains

Frequently Asked Questions

What does legacyTheme() do?
legacyTheme() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/css-functions.ts.
Where is legacyTheme() defined?
legacyTheme() is defined in packages/tailwindcss/src/css-functions.ts at line 129.
What does legacyTheme() call?
legacyTheme() calls 2 function(s): eventuallyUnquote, theme.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free