Guide
Colors
The components take their colors from CSS variables, so a color prop needs no Tailwind class of its own: each color is a palette class, .tallkit-color-{name}, that sets the same --tallkit-* variables to that color's shades. The accent color, used by primary buttons and accent variants, is a Tailwind theme color you can change.
Palettes
red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, slate, gray, zinc and stone come with the package, in resources/css/colors.css. A component given color="teal" adds the tallkit-color-teal class and uses the variables, as in bg-(--tallkit-soft) text-(--tallkit-on-soft):
Nothing to show
Most components with a color prop also take accent, and some take inverse (dark in light mode, light in dark mode); each component's doc lists what it accepts.
A palette of your own
Add the name to colors in config/tallkit.php, so the components accept it, and define its class in your stylesheet, after the package import. The class sets seven shades, --tallkit-100 to --tallkit-800 (no 600), and the package derives most variables from them; it also sets the solid and fill colors, the ones that depend on how dark the color is:
Nothing to show
Nothing to show
Here --color-brand-* are shades your @theme defines; any color value works. For a light color (like amber or yellow), use a dark text on the solid background, as in --tallkit-solid: var(--color-brand-400) with --tallkit-on-solid: var(--color-brand-950). The variables, in pairs of a background and the text that goes on it:
| Variables | Used for |
|---|---|
--tallkit-solid, --tallkit-solid-hover, --tallkit-on-solid |
Solid backgrounds, such as a colored primary button, and their hover. --tallkit-solid is also the strong text color. |
--tallkit-text |
Colored text: headings, texts, alerts, ghost and subtle buttons. |
--tallkit-soft, --tallkit-soft-hover, --tallkit-on-soft |
Soft, translucent backgrounds (badges, soft buttons, selected items) and their text. |
--tallkit-faint |
The lightest background, such as a hovered subtle button. |
--tallkit-border |
Tinted borders (alerts, badges, outline buttons). |
--tallkit-fill, --tallkit-on-fill |
Filled parts: a checked checkbox or radio, a selected day, a carousel indicator. |
--tallkit-ring, --tallkit-ring-soft |
The focus outline and the soft ring around it. |
--tallkit-pastel, --tallkit-on-pastel |
Pastel backgrounds, such as an avatar's initials, and their text. |
--tallkit-frame, --tallkit-on-frame |
The background of a header or footer with this color as its variant, and its text. |
The derived variables come from a rule in resources/css/colors.css that matches every tallkit-color-* class. Setting one in the palette class replaces it in both modes; set it again in @variant dark for a different dark value. A palette that sets every variable itself keeps working. --tallkit-solid, --tallkit-solid-hover, --tallkit-on-solid, --tallkit-frame and --tallkit-on-frame keep their light values in dark mode. Keep text on its background at WCAG AA contrast (4.5:1) in both modes, as the package palettes do.
The accent color
The accent is three Tailwind theme colors, defined in resources/css/theme.css:
| Variable | Light | Dark | Used for |
|---|---|---|---|
--color-accent |
zinc-800 |
white |
The background of primary buttons and accent variants. |
--color-accent-content |
zinc-800 |
white |
Accent text on the page background. |
--color-accent-foreground |
white |
zinc-800 |
Text on an accent background. |
Being theme colors, they also give you utilities such as bg-accent and text-accent-foreground. To change them, redefine them after the package import, in both modes:
Nothing to show
Disabled opacity
Disabled controls fade with the opacity-disabled utility, from the --opacity-disabled theme variable in resources/css/theme.css: 50% in light mode, 40% in dark mode. You can use it in your own markup too, as in disabled:opacity-disabled. To change it, redefine it after the package import, in both modes:
Nothing to show
How the package CSS layers with yours
- The palettes and the focus style are in Tailwind's
baselayer; the styles of layouts, tables, editors and animations, and parts of the fields, are in thecomponentslayer. A utility you put on a component is in theutilitieslayer, so it wins over both:focus-visible:outline-red-600replaces the package's focus outline, and a class passed through a prefixed attribute (tooltip:class,cell:class) applies as written. - The surface, border, focus ring and disabled and read-only states of the form controls are utilities of the package (
tallkit-control-*), in theutilitieslayer with yours; Tailwind places them before single-property utilities, so yours still wins with no!. Put it on the control through its prefix (input:class="bg-yellow-50"):classon the tag goes to the wrapper around it. - A few rules stay outside the layers because they must win over utilities, such as
x-cloak, the page scroll lock of an open modal, forced colors mode, and the colors inside a frame. - A header or footer with a frame
variant(a color,accentorinverse) gets thetallkit-frameclass. Inside it, the nav, nav items, brand, headings, texts, avatars and plain buttons take the frame's text color, and the focus outline uses the current color. That rule is outside the layers, so a text color of your own on those elements needs!, as intext-yellow-300!.