Home / Function/ themeKey() — tailwindcss Function Reference

themeKey() — tailwindcss Function Reference

Architecture documentation for the themeKey() function in theme.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  86530d3b_8bf7_83f5_43db_f717b3ab4ece["themeKey()"]
  e7a2e966_188e_28f5_d9d6_e54e27e0d0f2["Theme"]
  86530d3b_8bf7_83f5_43db_f717b3ab4ece -->|defined in| e7a2e966_188e_28f5_d9d6_e54e27e0d0f2
  7d80bf29_fbd8_157c_53c6_1be9105005cc["prefixKey()"]
  86530d3b_8bf7_83f5_43db_f717b3ab4ece -->|calls| 7d80bf29_fbd8_157c_53c6_1be9105005cc
  c6703f6a_b776_5326_6e96_8faaab8a851f["get()"]
  86530d3b_8bf7_83f5_43db_f717b3ab4ece -->|calls| c6703f6a_b776_5326_6e96_8faaab8a851f
  3330a25c_8114_660c_a3c7_8f1aaa37457d["escape()"]
  86530d3b_8bf7_83f5_43db_f717b3ab4ece -->|calls| 3330a25c_8114_660c_a3c7_8f1aaa37457d
  style 86530d3b_8bf7_83f5_43db_f717b3ab4ece fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/theme.ts lines 193–208

  #var(themeKey: string) {
    let value = this.values.get(themeKey)
    if (!value) {
      return null
    }

    // Since @theme blocks in reference mode do not emit the CSS variables, we can not assume that
    // the values will eventually be set up in the browser (e.g. when using `@apply` inside roots
    // that use `@reference`). Ensure we set up a fallback in these cases.
    let fallback = null
    if (value.options & ThemeOptions.REFERENCE) {
      fallback = value.value
    }

    return `var(${escape(this.prefixKey(themeKey))}${fallback ? `, ${fallback}` : ''})`
  }

Domain

Subdomains

Frequently Asked Questions

What does themeKey() do?
themeKey() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/theme.ts.
Where is themeKey() defined?
themeKey() is defined in packages/tailwindcss/src/theme.ts at line 193.
What does themeKey() call?
themeKey() calls 3 function(s): escape, get, prefixKey.

Analyze Your Own Codebase

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

Try Supermodel Free