A tiny tool for generating harmonious colour palettes! Features:
- simple, easy to use UI centered around your colours (looks pretty cool)
- easy ways to take your colours elsewhere
- a pretty nice generation algorithm based on basic colour theory (hue shifts, lightness variations, chroma adjustments, complimentary/analog schemes) and the OKLCH colour space (I spent quite a bit of time on it!), hidden behind an auto-switcher
- a way to pin individual colours to keep them between generations
- colour names using color-names
- chroma.js!!! and RandomColor
- color-names (and its API!)
- ky
- Vite and SvelteKit (+ adapter-static)
- Prettier, ESLint and TypeScript
It's pretty simple! Generation starts with getting a nice base colour using the baseColor library.
These colours are stored in neat Color classes (color.ts)
that have various methods useful for arriving at palettes using various principles
of simple color harmony.
For example, Color.withNeighbouringHues() can be used to create
analogous colour schemes,
by doing something like this:
// Color.withNeighbouringHues(color amount, center?, degree separation)
const analog: Palette = baseColor.withNeighbouringHues(3, true, 30) // analogous colour scheme with baseColor at the centerThere's also the nifty Color.withPropertyPoligons() that can be used
to create color polygon
(triadic, tetradic, pentagonic...) colour schemes:
// Color.withPropertyPoligons(property: 'lightness'|'chroma'|'hue', point quantity)
const triadic: Palette = baseColor.withPropertyPoligons('hue', 3)
const tetradic: Palette = baseColor.withPropertyPoligons('hue', 4)You can turn these base colour schemes into a chroma.js scale (a gradient, basically), from which you can get as many stops as you want to get a nice, pleasing palette!
I also use something I call the blend scalar method, which is quite basic and my favorite. Basically:
- Get two random base colours (let's call them
baseAandbaseB) - Mix
baseAandbaseBto getmixed - Get a random lightness shift of
mixed(middle) - Create a scale
- Profit!
-
Consider: do you like spaghetti this much?
-
Clone this repo, and install all the necessary dependencies:
$ git clone https://github.com/hs7t/nutmeg.git $ npm i
-
Run a development server:
$ npm run dev
-
Get a build when you're ready:
npm run build # check out ./dist afterward!
There's a GitHub Pages workflow available at .github/workflows.
No back-end is necessary - the distribution build works fully static.