0.0.3 • Published 4 months ago

@nclslbrn/artistry-swatch v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Artistry-swatch

A package to get random palette from iconic painting of art history

Installation

npm install @nclslbrn/artistry-swatch
  • or -
yarn add @nclslbrn/artistry-swatch

How use it

import { getPalette } from '@nclslbrn/artistry-swatch'

// No filter
const palette = getPalette()

// Specify a random value ($fx.rand() for exemple)
const palette = getPalette({ rand: 0.6 })

// Specify temperature of palette
const palette = getPalette({ temp: 'warm' })

// Specify if you want an inverted palette (dark background with bright colors)
const palette = getPalette({ theme: 'dark' })

// Specify an artist
const palette = getPalette({ artist: "Albrecht Dürer"})
 Parameters ValueDefault
randfloat between 0 & 1Math.random()
tempstring (cold, warm or any)any
themestring (bright, dark or any)any
artiststring (artist firstname + lastname or any)any

Returned palette object

The function getPalette return a palette or false if nothing match your criteria.

Every color is defined by an hexadecimal value (# include) without alpha.

Each palette has a background and a stroke (single color) and colors with multiple colors.

There is also some informations about the origin of the palette in meta (title, artist, year and techniques)

The getPalette will return only one palette, here is an exemple.

{
  background: "#1C2424",
  colors: ["#3D55A8", "#3FA622", "#F6F7F1", "#463D33"],
  stroke: "#6A6157",
  temp : "cold",
  theme: "dark",
  meta: {
    title: "Stained glass composition, Woman",
    artist: "Theo van Doesburg",
    year: "1917",
    techniques: "Glass",
  }
}