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
  b125fc67_5678_0420_003d_bf5a2aefd749["legacyTheme()"]
  922492dc_e389_db42_7c20_b86430d73e4c["eventuallyUnquote()"]
  b125fc67_5678_0420_003d_bf5a2aefd749 -->|calls| 922492dc_e389_db42_7c20_b86430d73e4c
  957946b3_94ca_8f71_30eb_76a6281c51df["theme()"]
  b125fc67_5678_0420_003d_bf5a2aefd749 -->|calls| 957946b3_94ca_8f71_30eb_76a6281c51df
  style b125fc67_5678_0420_003d_bf5a2aefd749 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.
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