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
  d3d61624_a27e_43e1_2242_240e76a1e1c8["legacyTheme()"]
  2189e39a_5595_cbd9_3bbe_eaf87ccf42a2["css-functions.ts"]
  d3d61624_a27e_43e1_2242_240e76a1e1c8 -->|defined in| 2189e39a_5595_cbd9_3bbe_eaf87ccf42a2
  6ba8fd83_f143_bcea_dfc9_b73a1e7b7660["eventuallyUnquote()"]
  d3d61624_a27e_43e1_2242_240e76a1e1c8 -->|calls| 6ba8fd83_f143_bcea_dfc9_b73a1e7b7660
  a14450c0_b6d2_d918_cff3_c3396641b12d["theme()"]
  d3d61624_a27e_43e1_2242_240e76a1e1c8 -->|calls| a14450c0_b6d2_d918_cff3_c3396641b12d
  style d3d61624_a27e_43e1_2242_240e76a1e1c8 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