Home / Function/ CustomizerCode() — ui Function Reference

CustomizerCode() — ui Function Reference

Architecture documentation for the CustomizerCode() function in theme-customizer.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  58ff6be5_2050_2b1b_9268_3918ae1d2f4e["CustomizerCode()"]
  99c48ee8_09f0_5ee4_48c9_597d941f294c["theme-customizer.tsx"]
  58ff6be5_2050_2b1b_9268_3918ae1d2f4e -->|defined in| 99c48ee8_09f0_5ee4_48c9_597d941f294c
  7a0a28fb_2687_f765_c5d6_2dba252a0c95["getThemeCodeOKLCH()"]
  58ff6be5_2050_2b1b_9268_3918ae1d2f4e -->|calls| 7a0a28fb_2687_f765_c5d6_2dba252a0c95
  10972c41_4a25_67bf_3dbf_48697c857cdc["getThemeCodeHSLV4()"]
  58ff6be5_2050_2b1b_9268_3918ae1d2f4e -->|calls| 10972c41_4a25_67bf_3dbf_48697c857cdc
  f78f47ee_4f41_8bcf_a739_bc76f2504d01["getThemeCode()"]
  58ff6be5_2050_2b1b_9268_3918ae1d2f4e -->|calls| f78f47ee_4f41_8bcf_a739_bc76f2504d01
  style 58ff6be5_2050_2b1b_9268_3918ae1d2f4e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/components/theme-customizer.tsx lines 166–630

function CustomizerCode({ themeName }: { themeName: string }) {
  const [hasCopied, setHasCopied] = React.useState(false)
  const [tailwindVersion, setTailwindVersion] = React.useState("v4-oklch")
  const activeTheme = React.useMemo(
    () => baseColors.find((theme) => theme.name === themeName),
    [themeName]
  )
  const activeThemeOKLCH = React.useMemo(
    () => baseColorsOKLCH[themeName as keyof typeof baseColorsOKLCH],
    [themeName]
  )

  React.useEffect(() => {
    if (hasCopied) {
      setTimeout(() => {
        setHasCopied(false)
      }, 2000)
    }
  }, [hasCopied])

  return (
    <>
      <Tabs
        value={tailwindVersion}
        onValueChange={setTailwindVersion}
        className="min-w-0 px-4 pb-4 md:p-0"
      >
        <TabsList>
          <TabsTrigger value="v4-oklch">OKLCH</TabsTrigger>
          <TabsTrigger value="v4-hsl">HSL</TabsTrigger>
          <TabsTrigger value="v3">Tailwind v3</TabsTrigger>
        </TabsList>
        <TabsContent value="v4-oklch">
          <figure
            data-rehype-pretty-code-figure
            className="!mx-0 mt-0 rounded-lg"
          >
            <figcaption
              className="text-code-foreground [&_svg]:text-code-foreground flex items-center gap-2 [&_svg]:size-4 [&_svg]:opacity-70"
              data-rehype-pretty-code-title=""
              data-language="css"
              data-theme="github-dark github-light-default"
            >
              <Icons.css className="fill-foreground" />
              app/globals.css
            </figcaption>
            <pre className="no-scrollbar max-h-[300px] min-w-0 overflow-x-auto px-4 py-3.5 outline-none has-[[data-highlighted-line]]:px-0 has-[[data-line-numbers]]:px-0 has-[[data-slot=tabs]]:p-0 md:max-h-[450px]">
              <Button
                data-slot="copy-button"
                size="icon"
                variant="ghost"
                className="bg-code text-code-foreground absolute top-3 right-2 z-10 size-7 shadow-none hover:opacity-100 focus-visible:opacity-100"
                onClick={() => {
                  copyToClipboardWithMeta(
                    getThemeCodeOKLCH(activeThemeOKLCH, 0.65),
                    {
                      name: "copy_theme_code",
                      properties: {
                        theme: themeName,
                        radius: 0.65,
                      },
                    }
                  )
                  setHasCopied(true)
                }}
              >
                <span className="sr-only">Copy</span>
                {hasCopied ? <IconCheck /> : <IconCopy />}
              </Button>
              <code data-line-numbers data-language="css">
                <span data-line className="line text-code-foreground">
                  &nbsp;:root &#123;
                </span>
                <span data-line className="line text-code-foreground">
                  &nbsp;&nbsp;&nbsp;--radius: 0.65rem;
                </span>
                {Object.entries(activeThemeOKLCH?.light).map(([key, value]) => (
                  <span
                    data-line
                    className="line text-code-foreground"
                    key={key}

Subdomains

Frequently Asked Questions

What does CustomizerCode() do?
CustomizerCode() is a function in the ui codebase, defined in apps/v4/components/theme-customizer.tsx.
Where is CustomizerCode() defined?
CustomizerCode() is defined in apps/v4/components/theme-customizer.tsx at line 166.
What does CustomizerCode() call?
CustomizerCode() calls 3 function(s): getThemeCode, getThemeCodeHSLV4, getThemeCodeOKLCH.

Analyze Your Own Codebase

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

Try Supermodel Free