v0.0.2
Demos (demo panel, opens in a new tab)

Colors

Components use colors by name (bg-surface, text-muted, bg-primary); the current color theme gives their values, so no dark: classes are needed.

css/themes.css zubazar/ui · free (MIT)

Palette

The values of the color names in the built-in light and dark themes.

ColorNameLightDarkUsage
Primary primary #794dff #794dff Buttons, links, selected states, the focus ring
Secondary secondary #6b7280 #6b7280 Grey buttons and badges
Success success #008933 #008933 Confirmed, completed, active
Info info #038197 #038197 Information
Warning warning #9f6b13 #9f6b13 Needs attention
Danger danger #d83838 #d83838 Deleting, errors
Dark dark #3f404d #2e2e2e The dark button
Accent accent #3472d8 #3472d8 The logo mark, menu counters
Page page #fafafa #0a0a0a The page background
Surface surface #ffffff #141414 Cards, menus, the top bar, dialogs, drawers
Field field #ffffff #1f1f1f Form fields, the white button
Sunken sunken #f4f4f5 #1f1f1f Table heads, tab bars, kbd
Hover hover #f4f4f5 #1f1f1f Rows and menu items
Track track #e4e4e7 #2e2e2e Progress bars, skeletons
Inverse inverse #18181b #2e2e2e Tooltips, toasts (text: on-inverse)
Line line #e4e4e7 #2e2e2e Borders, dividers
Strong line line-strong #d4d4d8 #474747 The frame of a form field
Control edge control #8d8d95 #787878 Checkboxes and radio buttons
Heading ink #18181b #f5f5f5 Heading text
Body body #3f3f46 #d4d4d4 Body text
Secondary text dim #52525c #a3a3a3 Secondary text
Muted text muted #6f6f79 #a3a3a3 Hints, labels, placeholders
Faint faint #9f9fa9 #787878 Decorative icons only, never text

Backgrounds and text

Backgrounds and text: view
BLADE

The page uses bg-page, cards bg-surface and recessed areas bg-sunken; for text, headings use text-ink, body text text-body, secondary text text-dim and hints text-muted.

blade
@foreach (['light' => 'Light mode', 'dark' => 'Dark mode'] as $theme => $name)
    <div data-theme="{{ $theme }}" class="rounded-sm bg-page p-4 ring-1 ring-line">
        <div class="space-y-1 rounded-sm bg-surface p-3 shadow-sm">
            <p class="text-sm font-semibold text-ink">{{ $name }} · text-ink</p>
            <p class="text-sm text-body">Body text · text-body</p>
            <p class="text-sm text-muted">Hint · text-muted</p>
            <p class="rounded-sm bg-sunken px-2 py-1 text-sm text-dim">Sunken area · bg-sunken</p>
        </div>
    </div>
@endforeach
PropValues
Backgroundbg-page · bg-surface · bg-field · bg-sunken · hover:bg-hover
Texttext-ink · text-body · text-dim · text-muted
Lineborder-line · divide-line · ring-line-strong

Meaning colors

Meaning colors: view
BLADE

Each color has a fill bg-{color} with its text text-on-{color}, a light background bg-{color}-tint with its text text-{color}-tint-ink, and text-{color}-ink for colored text.

blade
<div class="space-y-2">
    @foreach (['primary' => 'Primary', 'secondary' => 'Secondary', 'success' => 'Success', 'info' => 'Info', 'warning' => 'Warning', 'danger' => 'Danger', 'dark' => 'Dark', 'accent' => 'Accent'] as $color => $name)
        <div class="flex flex-wrap items-center gap-2 text-sm">
            <span class="w-20 text-muted">{{ $name }}</span>
            <span class="rounded-sm bg-{{ $color }} px-3 py-1 text-on-{{ $color }}">Fill</span>
            <span class="rounded-sm bg-{{ $color }}-tint px-3 py-1 text-{{ $color }}-tint-ink">Light background</span>
            <span class="font-medium text-{{ $color }}-ink">Colored text</span>
        </div>
    @endforeach
</div>
PropValues
Colorsprimary · secondary · success · info · warning · danger · dark · accent
Names{color} · {color}-hover · on-{color} · {color}-ink · {color}-line · {color}-tint · {color}-soft · {color}-tint-ink

Status badges

Status badges: view
BLADE

Show statuses with a light background and a dark text of the same color; for highlights that report no status (e.g. "New record"), use primary.

blade
<div class="flex flex-wrap gap-2 text-sm">
    <span class="rounded-sm bg-success-tint px-3 py-2 text-success-tint-ink">Delivered</span>
    <span class="rounded-sm bg-warning-tint px-3 py-2 text-warning-tint-ink">Pending</span>
    <span class="rounded-sm bg-danger-tint px-3 py-2 text-danger-tint-ink">Cancelled</span>
    <span class="rounded-sm bg-info-tint px-3 py-2 text-info-tint-ink">Notified</span>
    <span class="rounded-sm bg-primary-tint px-3 py-2 text-primary-tint-ink">New record</span>
</div>
PropValues
Background and textbg-{color}-tint text-{color}-tint-ink
A slightly stronger backgroundbg-{color}-soft

A dark or light part

A dark or light part: view
BLADE

Components inside an element with data-theme take that theme's colors.

blade
<div data-theme="dark" class="space-y-3 rounded-sm bg-surface p-4">
    <p class="text-sm text-body">A dark part: <span class="text-muted">data-theme="dark"</span></p>
    <zb:button size="sm">New order</zb:button>
    <div data-theme="light" class="rounded-sm bg-surface p-3 text-sm text-body">
        A light island inside: <span class="text-muted">data-theme="light"</span>
    </div>
</div>
PropValues
data-themelight · dark (nova, nova-dark… in Zubazar UI Pro's themes)

Changing the primary color

CSS

To change the primary color, set --zb-tone-primary in your CSS file; every primary name, the links and the focus ring derive from it.

css
/* resources/css/app.css, after the @import lines */
@layer base {
    :root, [data-theme] {
        --zb-tone-primary: #0f766e;
    }
}
PropValues
--zb-tone-primaryThe base value of the primary color
brand-colordefault · green · red · yellow · blue · gray · dark · #rrggbb (layout prop)

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
--zb-tone-primary—#794dffThe primary color; every primary name derives from it
--zb-tone-secondary—#6b7280The secondary (grey) color
--zb-tone-success—#00ca4bSuccess; its fill is the dark shade white text reads on (#008933)
--zb-tone-info—#04b6d4Info; its fill is #038197
--zb-tone-warning—#fcaa1eWarning; its fill is #9f6b13
--zb-tone-danger—#fb4141Danger; its fill is #d83838
--zb-tone-dark—#3f404dThe dark button; #2e2e2e in dark mode
--zb-tone-accent—#3b82f6Accent (blue)
--zb-page · --zb-surface · --zb-line · --zb-ink …—themes.cssThe neutral names; a theme sets only those that differ
--zb-focus—the primary toneThe keyboard focus ring (outline-focus, ring-focus)
--zb-user-*— — The user's measured color; written on <html> at runtime, don't set it yourself
data-theme—light<html> or any element: light · dark · nova · nova-dark…

Advanced

1 example

The user's color

The user's color: view
BLADE

The theme switcher's color section shows seven presets and a free color picker; the choice applies to the whole interface at once and is kept in the browser. "Default" is the theme's own color.

blade
<div class="space-y-4">
    <zb:theme-switcher as="inline" :sections="['color']" :reset="false" />
    <div class="flex flex-wrap items-center gap-3">
        <zb:button>Save</zb:button>
        <zb:button variant="soft">Draft</zb:button>
        <a href="#" class="text-sm font-medium text-primary-ink hover:underline">Link</a>
    </div>
</div>
PropValues
colorstrue · false · key => [#rrggbb, name]
customtrue · false (free color picker)

Developer notes

Events, hooks and details
  • The same markup looks right in light and dark mode, in a dark part of the page and in the color the user picked; the current data-theme gives the values.
  • Text on a fill reads at least 4.5:1 in every color.
  • The example joins the color names in a loop to stay short; write the full name in your own code (bg-success), because Tailwind only finds full names.
  • In dark mode, a status badge's background turns translucent and its text lighter.
  • data-theme changes only the colors; give the part its background yourself (bg-surface). When nested, the nearest data-theme wins.
  • The user's color is measured before use: button text darkens where it wouldn't read 4.5:1; links and the focus ring read 4.5:1 on light backgrounds and show at least 3:1 on dark surfaces in dark mode.
  • The other colors change with --zb-tone-success, --zb-tone-danger…; the color the user picks takes precedence over these values. Pass a saved color to the layout with the brand-color prop.
Zubazar UI · ZubazarDesigned for people.