Home / Function/ upsertThemeNode() — ui Function Reference

upsertThemeNode() — ui Function Reference

Architecture documentation for the upsertThemeNode() function in update-css-vars.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  3662dc7c_005d_b2d3_9a08_eb02c2acaad8["upsertThemeNode()"]
  09244f5d_7fce_b385_220b_05945bb9e93b["update-css-vars.ts"]
  3662dc7c_005d_b2d3_9a08_eb02c2acaad8 -->|defined in| 09244f5d_7fce_b385_220b_05945bb9e93b
  b9266edd_762e_e91a_7f0a_fcd26e8e87a3["updateCssVarsPluginV4()"]
  b9266edd_762e_e91a_7f0a_fcd26e8e87a3 -->|calls| 3662dc7c_005d_b2d3_9a08_eb02c2acaad8
  9e221c92_a132_552e_5f2f_e0d1591df611["updateThemePlugin()"]
  9e221c92_a132_552e_5f2f_e0d1591df611 -->|calls| 3662dc7c_005d_b2d3_9a08_eb02c2acaad8
  315344ca_3575_e78f_468b_3956823df10b["updateTailwindConfigKeyframesPlugin()"]
  315344ca_3575_e78f_468b_3956823df10b -->|calls| 3662dc7c_005d_b2d3_9a08_eb02c2acaad8
  1662bbcf_2db2_62d6_ddb3_663c71236ffd["updateTailwindConfigAnimationPlugin()"]
  1662bbcf_2db2_62d6_ddb3_663c71236ffd -->|calls| 3662dc7c_005d_b2d3_9a08_eb02c2acaad8
  style 3662dc7c_005d_b2d3_9a08_eb02c2acaad8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-css-vars.ts lines 597–617

function upsertThemeNode(root: Root): AtRule {
  let themeNode = root.nodes.find(
    (node): node is AtRule =>
      node.type === "atrule" &&
      node.name === "theme" &&
      node.params === "inline"
  )

  if (!themeNode) {
    themeNode = postcss.atRule({
      name: "theme",
      params: "inline",
      nodes: [],
      raws: { semicolon: true, between: " ", before: "\n" },
    })
    root.append(themeNode)
    root.insertBefore(themeNode, postcss.comment({ text: "---break---" }))
  }

  return themeNode
}

Subdomains

Frequently Asked Questions

What does upsertThemeNode() do?
upsertThemeNode() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-css-vars.ts.
Where is upsertThemeNode() defined?
upsertThemeNode() is defined in packages/shadcn/src/utils/updaters/update-css-vars.ts at line 597.
What calls upsertThemeNode()?
upsertThemeNode() is called by 4 function(s): updateCssVarsPluginV4, updateTailwindConfigAnimationPlugin, updateTailwindConfigKeyframesPlugin, updateThemePlugin.

Analyze Your Own Codebase

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

Try Supermodel Free