Build websites 10x faster with HextaUI Blocks — Learn more
UI/Foundation

Theming

How to customize the look and feel of HextaUI components using themes.

Variables

app/globals.css
@theme {
  --radius-ele: var(--radius); /* Element radius */
  --radius-card: var(--card-radius); /* Card radius */

  --color-background: hsl(var(--hu-background));
  --color-foreground: hsl(var(--hu-foreground));

  --color-card: hsl(var(--hu-card));
  --color-card-foreground: hsl(var(--hu-card-foreground));

  --color-primary: hsl(var(--hu-primary));
  --color-primary-foreground: hsl(var(--hu-primary-foreground));

  --color-accent: hsl(var(--hu-accent));
  --color-accent-foreground: hsl(var(--hu-accent-foreground));

  --color-secondary: hsl(var(--hu-secondary));
  --color-secondary-foreground: hsl(var(--hu-secondary-foreground));

  --color-muted: hsl(var(--hu-muted));
  --color-muted-foreground: hsl(var(--hu-muted-foreground));

  --color-destructive: hsl(var(--hu-destructive));
  --color-destructive-foreground: hsl(var(--hu-destructive-foreground));

  --color-border: hsl(var(--hu-border));
  --color-input: hsl(var(--hu-input));
  --color-ring: hsl(var(--hu-ring));
}

:root {
  --radius: 0.8rem;
  --card-radius: 1rem;

  --hu-background: 0, 0%, 100%;
  --hu-foreground: 0, 0%, 14%;

  --hu-card: 0, 0%, 99%;
  --hu-card-foreground: 0, 0%, 14%;

  --hu-primary: 235, 100%, 60%;
  --hu-primary-foreground: 0, 0%, 98%;

  --hu-secondary: 0, 0%, 97%;
  --hu-secondary-foreground: 0, 0%, 20%;

  --hu-muted: 0, 0%, 97%;
  --hu-muted-foreground: 0, 0%, 56%;

  --hu-accent: 0, 0%, 96%;
  --hu-accent-foreground: 0, 0%, 20%;

  --hu-destructive: 9, 96%, 47%;
  --hu-destructive-foreground: 0, 0%, 98%;

  --hu-border: 0, 0%, 92%;
  --hu-input: 0, 0%, 100%;
  --hu-ring: 0, 0%, 71%;
}

.dark {
  --hu-background: 0, 0%, 7%;
  --hu-foreground: 0, 0%, 100%;

  --hu-card: 0, 0%, 9%;
  --hu-card-foreground: 0, 0%, 100%;

  --hu-primary: 235, 100%, 60%;
  --hu-primary-foreground: 0, 0%, 98%;

  --hu-secondary: 0, 0%, 15%;
  --hu-secondary-foreground: 0, 0%, 100%;

  --hu-muted: 0, 0%, 15%;
  --hu-muted-foreground: 0, 0%, 71%;

  --hu-accent: 0, 0%, 15%;
  --hu-accent-foreground: 0, 0%, 100%;

  --hu-destructive: 0, 84%, 50%;
  --hu-destructive-foreground: 0, 0%, 98%;

  --hu-border: 0, 0%, 100%, 10%;
  --hu-input: 0, 0%, 100%, 5%;
  --hu-ring: 0, 0%, 56%;
}

Customizing Colors

You can customize the HextaUI color palette by overriding these CSS variables in your own stylesheet:

Custom theme example
:root {
  /* Custom primary colors */
  --hu-primary: 221, 83%, 53%;
  --hu-primary-foreground: 0, 0%, 98%;

  /* Custom destructive colors */
  --hu-destructive: 0, 84%, 60%;
  --hu-destructive-foreground: 0, 0%, 98%;
}
Edit on GitHub

Last updated on