tdpxl

Migrating from shadcn/ui or Radix Colors

Keep your old components while you move to tdpxl, on one theme instead of two.

A migration rarely happens in one go. For weeks, a project runs its old components next to new tdpxl ones. Without help, it also runs two themes: the old system's variables and tdpxl's roles. Every brand color and every dark-mode fix then has to be made twice, and the two halves of the app drift apart.

A bridge removes the second theme. It defines the variable names your old components read, and points each one at a tdpxl role. tdpxl becomes the only theme; the old components follow it, in light and dark, until you delete them.

BridgeInstallAnswers
shadcn/uinpx @tdpxl/cli add bridge-shadcn--background, --foreground, --card, --popover, --primary, --secondary, --muted, --accent, --destructive (each with -foreground), --border, --input, --ring, --radius, the --sidebar-* set, and the Tailwind utilities that use them (bg-background, rounded-md …)
Radix Colorsnpx @tdpxl/cli add bridge-radix-colors--{scale}-1 … --{scale}-12 for gray, slate, blue, green, orange, yellow, amber, red and purple, light and dark

The shadcn/ui bridge contains no colors, only var() references to tdpxl roles, so it cannot drift from the theme and dark mode needs nothing extra. Radix Colors names hues rather than roles, so its bridge carries tdpxl's ramp colors itself (see below).

A dark section inside a light page (<div className="dark">) works for inline components. Menus, dialogs and popovers render in a portal at the end of <body>, outside that section, so they follow the page's theme, not the section's. That is true of tdpxl's own components too.

Set it up

  1. Run npx @tdpxl/cli init if the project does not have tdpxl yet.

  2. Add the bridge. It is written to tdpxl/bridges/<name>.css.

  3. Import it in your stylesheet after the tdpxl theme section:

    @import "tailwindcss";
    /* tdpxl:theme:start … tdpxl:theme:end */
    @import "../tdpxl/bridges/shadcn.css";
  4. Delete the old system's color variables (for shadcn/ui, the :root, .dark and @theme inline color blocks in your globals.css). If you keep them, whichever rule comes last wins, and you are back to two themes.

  5. Run npx @tdpxl/cli check to confirm the tdpxl theme still passes contrast.

From here, change colors only in the tdpxl theme, as described in Theming. Old and new components both follow.

How shadcn/ui names map

Each name points at the role tdpxl's own components use for the same job.

shadcn/uitdpxl role
background, card, popoverwhite-0
foreground and the -foreground of neutral surfacesstrong-950
primary, ring, sidebar-primary, sidebar-ringprimary-base
primary-foreground, destructive-foreground, sidebar-primary-foregroundwhite-0
secondary, muted, accent, sidebarweak-50
muted-foregroundsub-600
destructiveerror-base
border, input, sidebar-border, sidebar-accentsoft-200
radiusradius-10 (0.625rem)
chart-1 … chart-5Already tdpxl roles with the same names

The mapping is a starting point, not a rule. To send one name elsewhere, override it after the bridge import, for example :root { --accent: var(--primary-alpha-10); }.

How Radix Colors steps map

Radix gives each step a job: 1–2 backgrounds, 3–5 component fills, 6–8 borders, 9–10 solid fills, 11–12 text. In light, steps 1–12 follow tdpxl's ramp in order (25 … 950), so step 9 is the 700 that tdpxl's *-base roles use. In dark, Radix keeps step 9 a saturated solid, so it lands on tdpxl's 500, and 11–12 are the light steps tdpxl's dark text roles use. Dark has fewer ramp steps to spend, so a few steps are midpoints between two tdpxl steps; every step stays distinct, so hover and pressed fills (3 → 4 → 5) still show.

The tdpxl theme installs roles, not ramps, so this bridge writes the ramp colors itself. They do not follow a tdpxl rebrand: move a component to tdpxl roles when it should. It switches with .light/.light-theme and .dark/.dark-theme, so nested sections of either scheme work.

slate and amber map to tdpxl's gray and yellow. Other Radix hues, the alpha scales (--blue-a1 …) and the P3 variants are not bridged: tdpxl has no ramp to answer them. Keep those from Radix for now, or move those components to tdpxl roles first.

When you are done

Once no component reads the old names, remove the import and run npx @tdpxl/cli remove bridge-shadcn (or bridge-radix-colors).

On this page