# Installation
Via npm
Install the package from npm:
npm install acorn.css
Then import it:
import 'acorn.css';
Or in CSS:
@import 'acorn.css';
Via CDN
<link rel="stylesheet" href="https://unpkg.com/acorn.css@latest/dist/acorn.min.css">
Quick start — customize with CSS variables
:root {
--primary: #0b779f; /* cyan */
--secondary: #f4bb1a; /* gold */
--accent: #e62e6b; /* magenta / pink */
--button-radius: 1.5625rem;
--container-default: 60rem;
}
# What Acorn is (and isn't)
Acorn styles content, not layout. It's opinionated about how content looks and reads, and deliberately not a grid system, a utility framework, or a component library. It ships no presentational classes — so when you reach for a class, it's yours and you know exactly what it does.
- Classless: write semantic HTML, get a styled page.
- Complete: styles the elements people forget — blockquotes, tables, figures, footnotes, task lists, form controls.
- Customizable: everything themes through CSS custom properties.
- Accessible: WCAG AA color contrast and proper focus management out of the box.
- Tiny: around 5KB gzipped, no JavaScript.
Because it's classless, anything that emits clean semantic HTML — including Markdown and AI-generated content — gets styled automatically.
# Customization
Customize through CSS custom properties:
--primary,--secondary,--accent- CMYK-leaning brand colors (cyan, gold, magenta) with
-light/-darkvariants. All defaults pass WCAG AA in both themes. --space-1through--space-5- Spacing scale, rule of 2: 8px, 16px, 32px, 64px, 128px. Deliberately coarse — fine spacing is your layout's job.
--text-xsthrough--text-3xl- Type scale (1.25 ratio). Display sizes scale fluidly with the viewport via
clamp(); body text stays fixed. --container-narrow,--container-default- Reading widths: 45rem (narrow) and 60rem (default).
--border-radius- Base radius for inputs, code, cards.
--button-radius- Button radius, separate from
--border-radiusso buttons round independently (25px default).
Dark mode
Built in. Toggle it with an attribute:
<html data-theme="dark"> <!-- or "light" -->
Or follow the system preference with a line of JavaScript:
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light');
Note: this demo uses the toggle button in the bottom-right corner.
this text wraps around the right-aligned image on wider screens and stacks normally on narrow ones. Use