Quickstart
Install, pick a build, set a color.
Install
# pnpm
pnpm add @sparkstone/css
# yarn
yarn add @sparkstone/css
# npm
npm install @sparkstone/css
Pick a build
The package root is the class build. The classless build, which is the 1.x
theme, lives at /classless.
// Sass, either build. Needs the Node package importer:
// sass --pkg-importer=node
// importers: [new NodePackageImporter()]
@use "pkg:@sparkstone/css";
@use "pkg:@sparkstone/css/classless";
// Precompiled CSS
import "@sparkstone/css"; // dist/index.css
import "@sparkstone/css/classless"; // dist/classless.css
A complete page
Switch the tab to see the same page in the other build.
<!DOCTYPE html>
<html lang="en" data-color-scheme="light">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="index.css" />
<style>
:root {
--color: teal;
}
</style>
</head>
<body class="prose">
<main class="container">
<h1>Hello</h1>
<p>Body copy, and <a href="#" class="link">a link</a>.</p>
<article class="card">
<h2>A card</h2>
<p>Cards are just articles.</p>
<footer class="card-actions">
<button class="btn btn-secondary">Cancel</button>
<button class="btn">Confirm</button>
</footer>
</article>
</main>
</body>
</html>
<!DOCTYPE html>
<html lang="en" data-color-scheme="light">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="classless.css" />
<style>
:root {
--color: teal;
}
</style>
</head>
<body>
<main class="container">
<h1>Hello</h1>
<p>Body copy, and <a href="#">a link</a>.</p>
<article>
<h2>A card</h2>
<p>Cards are just articles.</p>
<footer>
<button class="secondary">Cancel</button>
<button>Confirm</button>
</footer>
</article>
</main>
</body>
</html>
Set your color
One custom property drives the whole palette. Everything else is derived from
it in oklch.
:root {
--color: teal;
}
Coming from 1.x
- Replace
dist/theme.csswithdist/classless.css. - Replace
src/theme.scsswithsrc/classless.scss, or importpkg:@sparkstone/css/classless. input[type="submit"|"reset"|"button"]is now styled only as a button. In 1.x it also picked up the text-field width, height and bottom margin..cardis the base card in both builds now. Rename 1.x's.cardto.card-borderfor the bordered look.- The classless build now ships the class names too, so
.btn,.inputand the rest work there as well. - Moving to classes?
.cardbecomes.card-border, and dialogs pick up.dialog,.dialog-boxand.dialog-actions.