1.3.0 โ€ข Published 1 month ago

@sparkstone/css v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

@sparkstone/css

A minimal CSS framework inspired by Pico.css, rebuilt with oklch() color primitives and a powerful, themeable design system using native CSS custom properties.

๐Ÿ”— View on NPM | View on GitHub


โœจ Features

  • ๐Ÿ’ก Built with oklch() for perceptually uniform color scales
  • ๐ŸŒ— Automatic light/dark theming with CSS variables
  • ๐Ÿงฑ Minimal class usage (like card, contrast, ghost)
  • โšก No JS required for core styles
  • ๐ŸŽจ Fully themeable via CSS variables or Sass functions
  • ๐Ÿงฉ SCSS mixins for advanced integrations

๐Ÿš€ Install

# pnpm
pnpm add @sparkstone/css
# yarn
yarn add @sparkstone/css
# npm
npm install @sparkstone/css

๐ŸŒ Live Demo & Docs

Explore the docs and theme live:

๐Ÿ”— https://sparkstonepdx.github.io/css/docs


๐Ÿ“ฆ Usage

Import in your project:

// SCSS (recommended)
import '@sparkstone/css/src/theme.scss';

// Or precompiled CSS
import '@sparkstone/css/theme.css';

Apply base HTML structure:

<article class="card">
  <h2>Hello World</h2>
  <p>This card uses the default theme and layout utilities.</p>
</article>

๐ŸŽจ Theming

Set custom colors using CSS variables:

:root {
  --color: rebeccapurple;
  --primary-color: blue;
  --accent-color: oklch(from var(--color) l c calc(h + 180));
  --error-color: maroon;
}

System-based dark mode is supported by default, but you can override manually:

<html data-color-scheme="light">
  <!-- or -->
  <html data-color-scheme="dark"></html>
</html>

๐Ÿง‘โ€๐ŸŽจ Theme Swatches

Use these CSS variables for consistent contrast:

  • --text-lc-1 ... --text-lc-9
  • --surface-lc-1 ... --surface-lc-9

They adjust automatically in dark/light mode and derive from --color.

You can preview or override them using:

@use '@sparkstone/css/src/vars.scss' as *;

// Example: generate a color
color: get-color(var(--text-lc-2), var(--accent-color));
border-color: get-border-color();

๐Ÿงช Documentation

See it live via GitHub Pages:

  • forms.html โ€” Styled form elements and validation states
  • colors.html โ€” Theme-based palette viewer with interactive color picker
  • containers.html โ€” Articles, cards, and dialogs
  • index.html โ€” Overview & installation

Each page includes copyable code examples and live previews.


๐Ÿ›  Dev

pnpm install
pnpm dev

This watches both src/ and pages/ for changes. It compiles SCSS to dist/, renders Nunjucks templates from pages/ to docs/, and serves with live reload.

To build manually:

pnpm build

๐Ÿ“ฆ Package Structure

dist/       # Compiled CSS
src/        # Source SCSS (theme, vars, functions)
pages/      # Nunjucks page templates
templates/  # Shared macros and layout
docs/       # Output static site for GitHub Pages

๐Ÿ’ฌ License

MIT ยฉ Sparkstone LLC

1.3.0

1 month ago

1.2.0

2 months ago

1.1.0

2 months ago

1.0.0

2 months ago