Home / Function/ themeToVarUtility() — tailwindcss Function Reference

themeToVarUtility() — tailwindcss Function Reference

Architecture documentation for the themeToVarUtility() function in canonicalize-candidates.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  fbde7575_ebdd_2a7f_c0f4_59eceb35efc2["themeToVarUtility()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  fbde7575_ebdd_2a7f_c0f4_59eceb35efc2 -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  style fbde7575_ebdd_2a7f_c0f4_59eceb35efc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 583–613

function themeToVarUtility(candidate: Candidate, options: InternalCanonicalizeOptions): Candidate {
  let convert = options.designSystem.storage[CONVERTER_KEY]

  if (candidate.kind === 'arbitrary') {
    let [newValue, modifier] = convert(
      candidate.value,
      candidate.modifier === null ? Convert.MigrateModifier : Convert.All,
    )
    if (newValue !== candidate.value) {
      candidate.value = newValue

      if (modifier !== null) {
        candidate.modifier = modifier
      }
    }
  } else if (candidate.kind === 'functional' && candidate.value?.kind === 'arbitrary') {
    let [newValue, modifier] = convert(
      candidate.value.value,
      candidate.modifier === null ? Convert.MigrateModifier : Convert.All,
    )
    if (newValue !== candidate.value.value) {
      candidate.value.value = newValue

      if (modifier !== null) {
        candidate.modifier = modifier
      }
    }
  }

  return candidate
}

Domain

Subdomains

Frequently Asked Questions

What does themeToVarUtility() do?
themeToVarUtility() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is themeToVarUtility() defined?
themeToVarUtility() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 583.

Analyze Your Own Codebase

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

Try Supermodel Free