Skip to content

Latest commit

 

History

History

colorido

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

colorido

Set of helpers and types to work with RGBA colors as [number, number, number, number] tuples.

Install

$ yarn add colorido

Usage

type TColor = [number, number, number, number]

colorToString(color: TColor) => string

isColor(value: any) => value is TColor
import { colorToString, isColor } from 'colorido'

const color = [255, 0, 0, 1]

console.log(
  colorToString(color)
)
// "rgba(255, 0, 0, 1)"

console.log(
  isColor(color)
)
// true