@ojiepermana/angular-theme
v22.0.59
Published
Composable Angular 22 application layouts, page shells, and CSS theme tokens.
Downloads
3,877
Maintainers
Readme
@ojiepermana/angular-theme
Theme layer for the @ojiepermana/angular design system: a runtime provider
(mode / color / neutral / brand), design tokens, and the Tailwind v4 CSS that the
components are styled against.
bun add @ojiepermana/angular-theme
# or: npm install @ojiepermana/angular-themeEntry points
| Import path | Contents |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| @ojiepermana/angular-theme/styles | provideUiTheme, ThemeModeService, ThemeColorService, ThemeBrandService, ThemeRadiusService, ThemeSpaceService, … |
| @ojiepermana/angular-theme/layout | Layout shell building blocks |
| @ojiepermana/angular-theme/page | Page-level scaffolding |
| @ojiepermana/angular-theme/theme.css | Base tokens + component styles only — lightweight, no runtime axes |
| @ojiepermana/angular-theme/theme-full.css | Base + every runtime axis (color, neutral, radius, space) — needed for ThemeColorService/ThemeNeutralService switching |
| @ojiepermana/angular-theme/styles/css/* | Raw CSS assets (per-axis color + neutral palettes, Tailwind map) |
Tailwind v4 setup
The CSS is published with the package and addressable by name. Use theme-full.css
for the full design system (runtime color/neutral switching); use the lightweight
theme.css plus only the axes you need for a smaller bundle.
/* styles.css — full design system */
@import '@ojiepermana/angular-theme/theme-full.css'; /* base + all color + neutral palettes */
@import 'tailwindcss';
@import '@ojiepermana/angular-theme/styles/css/base/tailwind.css'; /* maps tokens → bg-primary, bg-brand, text-foreground, … */For a lightweight setup, import the base then opt in to specific axes:
/* styles.css — base + only the axes you use */
@import '@ojiepermana/angular-theme/theme.css'; /* base tokens + components, no axes */
@import 'tailwindcss';
@import '@ojiepermana/angular-theme/styles/css/base/tailwind.css';
@import '@ojiepermana/angular-theme/styles/css/color/index.css'; /* opt in to accent palettes */
@import '@ojiepermana/angular-theme/styles/css/neutral/index.css'; /* opt in to neutral families */Requires Tailwind CSS ^4.3.0.
Provider
import { provideUiTheme } from '@ojiepermana/angular-theme/styles';
export const appConfig = {
providers: [
provideUiTheme({
mode: 'light',
color: 'base', // accent palette (base, red…rose, brand)
neutral: 'base', // gray family (base, slate, gray, zinc, …)
radius: 'md', // corner radius preset (none, sm, md, lg, xl, full)
space: 'normal', // spacing density preset (compact, normal, relaxed, spacious)
brand: { color: '221 83% 53%', foreground: '0 0% 100%' }, // consumer brand
}),
],
};mode— bootstrapsThemeModeServiceand persists the default mode (light/dark/system).color— bootstrapsThemeColorService; initial accent palette (<html theme-color>).neutral— initial neutral family (<html theme-neutral>); composes with any accent.radius— bootstrapsThemeRadiusService; initial corner-radius preset (<html theme-radius>). Drives the single--radius-baseknob so the whole--radius-*scale androunded-*utilities follow. Values:none,sm,md(default),lg,xl,full.space— bootstrapsThemeSpaceService; initial spacing-density preset (<html theme-space>). Drives the single--spacing-baseknob so everyp-*/m-*/gap-*/w-*/h-*utility follows. Values:compact,normal(default),relaxed,spacious.brand— bootstrapsThemeBrandService; sets--brand/bg-brandand thetheme-color='brand'accent preset. Accepts an HSL triplet string ('221 83% 53%') or{ color, foreground }. Settable at runtime viasetBrand().
A persisted choice (localStorage theme-color / theme-neutral / theme-radius /
theme-space / theme-brand) always wins over the configured default.
Color system (FluxUI-style)
Four independent axes switch at runtime via attribute selectors on <html>:
- accent (
theme-color) —base(core),red … rose, andbrand. Each re-tints the full palette.base= no override. - neutral (
theme-neutral) —base(core),slate,gray,zinc,neutral,stone,mauve,olive,mist,taupe. Overrides the gray family and Layout's decorative pattern source, and is layered after accent so it wins both token groups. With neutralbase, surface patterns follow the active accent; every other neutral gives them its own soft family hue. - radius (
theme-radius) —none,sm,md(default),lg,xl,full. Sets the--radius-baseknob; the full--radius-*scale androunded-*utilities follow. - space (
theme-space) —compact,normal(default),relaxed,spacious. Sets the--spacing-baseknob; everyp-*/m-*/gap-*/w-*/h-*utility follows.
theme-full.css (i.e. styles/css/index.css) bundles the core base theme plus
every accent and neutral palette, so switching needs no runtime CSS loading. The
lightweight theme.css ships base only — import the axis files you need on top of
it (or use theme-full.css) to enable runtime switching.
Material Symbols icons (opt-in)
provideUiTheme() makes no external network request by default. To preload the
Material Symbols font from Google Fonts:
provideUiTheme({ icons: { materialSymbols: true } });Leave it off (the default) for privacy / offline / strict CSP, and self-host the font in your own stylesheet if you need it.
