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
  dc89164d_c61b_66e1_83f4_7a616b6a7dcb["legacyTheme()"]
  25abd826_ded0_51aa_d570_896030f4d458["eventuallyUnquote()"]
  dc89164d_c61b_66e1_83f4_7a616b6a7dcb -->|calls| 25abd826_ded0_51aa_d570_896030f4d458
  552e707a_ccba_b2a6_5917_15f7a417896b["theme()"]
  dc89164d_c61b_66e1_83f4_7a616b6a7dcb -->|calls| 552e707a_ccba_b2a6_5917_15f7a417896b
  style dc89164d_c61b_66e1_83f4_7a616b6a7dcb 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
}

Subdomains

Frequently Asked Questions

What does legacyTheme() do?
legacyTheme() is a function in the tailwindcss codebase.
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