Home / Function/ themeableValues() — tailwindcss Function Reference

themeableValues() — tailwindcss Function Reference

Architecture documentation for the themeableValues() function in apply-config-to-theme.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  f0444c59_74bb_21c0_b8e1_c65ad667fa51["themeableValues()"]
  245c850a_c551_a2cf_854e_bba95b5a1339["apply-config-to-theme.ts"]
  f0444c59_74bb_21c0_b8e1_c65ad667fa51 -->|defined in| 245c850a_c551_a2cf_854e_bba95b5a1339
  e26bfad3_530e_6523_7463_161205321110["migrateTheme()"]
  e26bfad3_530e_6523_7463_161205321110 -->|calls| f0444c59_74bb_21c0_b8e1_c65ad667fa51
  9fb2cb3b_46e1_4148_c220_0e7f4519db6d["applyConfigToTheme()"]
  9fb2cb3b_46e1_4148_c220_0e7f4519db6d -->|calls| f0444c59_74bb_21c0_b8e1_c65ad667fa51
  b92bc591_9881_2dfd_426d_e63f7f4fb8b8["walk()"]
  f0444c59_74bb_21c0_b8e1_c65ad667fa51 -->|calls| b92bc591_9881_2dfd_426d_e63f7f4fb8b8
  2c00ecd1_4408_06d4_3478_3c9858d9b60d["isValidThemePrimitive()"]
  f0444c59_74bb_21c0_b8e1_c65ad667fa51 -->|calls| 2c00ecd1_4408_06d4_3478_3c9858d9b60d
  3c4c3fa1_3dc8_df16_2245_0aed0adc55f6["isValidThemeTuple()"]
  f0444c59_74bb_21c0_b8e1_c65ad667fa51 -->|calls| 3c4c3fa1_3dc8_df16_2245_0aed0adc55f6
  style f0444c59_74bb_21c0_b8e1_c65ad667fa51 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/compat/apply-config-to-theme.ts lines 112–148

export function themeableValues(config: ResolvedConfig['theme']): [string[], unknown][] {
  let toAdd: [string[], unknown][] = []

  walk(config as any, [], (value, path) => {
    if (isValidThemePrimitive(value)) {
      toAdd.push([path, value])

      return WalkAction.Skip
    }

    if (isValidThemeTuple(value)) {
      toAdd.push([path, value[0]])

      for (let key of Reflect.ownKeys(value[1]) as string[]) {
        toAdd.push([[...path, `-${key}`], value[1][key]])
      }

      return WalkAction.Skip
    }

    if (Array.isArray(value) && value.every((v) => typeof v === 'string')) {
      if (path[0] === 'fontSize') {
        toAdd.push([path, value[0]])

        if (value.length >= 2) {
          toAdd.push([[...path, '-line-height'], value[1]])
        }
      } else {
        toAdd.push([path, value.join(', ')])
      }

      return WalkAction.Skip
    }
  })

  return toAdd
}

Subdomains

Frequently Asked Questions

What does themeableValues() do?
themeableValues() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/compat/apply-config-to-theme.ts.
Where is themeableValues() defined?
themeableValues() is defined in packages/tailwindcss/src/compat/apply-config-to-theme.ts at line 112.
What does themeableValues() call?
themeableValues() calls 3 function(s): isValidThemePrimitive, isValidThemeTuple, walk.
What calls themeableValues()?
themeableValues() is called by 2 function(s): applyConfigToTheme, migrateTheme.

Analyze Your Own Codebase

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

Try Supermodel Free