Theming

Control toast colors with theme mode, richColors, and CSS variables. Override tokens after the package stylesheet.

Theme mode

toast.config({ theme: "light" }); // default
toast.config({ theme: "system" }); // OS + html.dark / data-theme
toast.config({ theme: "dark" });
toast.config({ richColors: true });

// Per-toast override
toast.success("Saved", { richColors: true });

With theme: "system" the toaster tracks prefers-color-scheme,html.dark / html.light, and html[data-theme].

Icons and progress

Built-in icons use explicit stroke: var(--an-success) (and matching tokens for error, warning, info). They are not driven by currentColor, so a global * { color: … } rule cannot recolor them. Progress bars use a lighter tint of the same accent token as the toast type.

CSS variables

Override colors on .an-toaster in your stylesheet after the package CSS.

.an-toaster {
  --an-bg: #ffffff;
  --an-fg: #0f172a;
  --an-muted: #475569;
  --an-border: rgba(15, 23, 42, 0.1);
  --an-success: #15803d;
  --an-error: #e11d48;
  --an-warning: #b45309;
  --an-info: #1d4ed8;
  --an-success-bg: #ecfdf5;
  --an-error-bg: #fff1f2;
  --an-warning-bg: #fffbeb;
  --an-info-bg: #eff6ff;
}

.an-toaster[data-theme="dark"] {
  --an-bg: #1e293b;
  --an-fg: #f8fafc;
}