2.1.3 • Published 3 years ago

@gameflow-tv/ambiance v2.1.3

Weekly downloads
-
License
NONE
Repository
github
Last release
3 years ago

ambiance

Library for color palette generation and related utlities such as React components and utilities.

Usage

Palette

To get a color palette from a hex color:

const palette = paletteFromHex(color)

To get a color palette from a RGB color:

const rgb = { r: 255, g: 191, b: 0 }
const palette = paletteFromRGB(rgb)

Average color

The API is exported through two different modules for Node and the browser.

Get average color (Node.js):

import { getAverageColorFromURL } from '@gameflow-tv/ambiance/node'

const color = await getAverageColorFromURL('#ffbf00')

Get average color (browser):

import { getAverageColorFromURL } from '@gameflow-tv/ambiance/browser'

const color = await getAverageColorFromURL('#ffbf00')

Reason: @gameflow-tv/ambiance uses fast-average-color under-the-hood. The library has separate browser and Node APIs, which means that ambiance has to export separate modules. These are found in @gameflow-tv/ambiance/browser and @gameflow-tv/ambiance/node.