toombez / coloretic

A library for creating and manipulating various color spaces

Home Page:https://toombez.github.io/coloretic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coloretic

Library for creating and manipulating various color spaces

Features

  • Immutability
  • Fully typed
  • Zero dependency

Quick start

  1. Install the package:
  • with npm
npm i coloretic
  • with yarn
yarn add coloretic
  • with pnpm
pnpm i coloretic
  1. Use the package:
// Creating color
const red = createRGBColor({ red: 255, blue: 0, green: 0 })
const white = createRGBColor({ red: 255, blue: 255, green: 255 })
const black = createRGBColor({ red: 0, blue: 0, green: 0 })

// Change color
const violet = setBlue(255, red)
const yellow = setGreen(255, red)
const semiTransparentRed = transparentize(0.5, red)

// Converting colors
const hslRed = HSL2RGB(red)

// Operate with colors
const gray = mixRGB(white, black, 0.5)
const semiTransparentViolet = alphaBlendingRGB(
  semiTransparentRed,
  createRGBColor({ red: 0, green: 0, blue: 255, alpha: 0.5 }),
)

To learn more about what the library can do check out the 📚️ documentation


LICENCE MIT - Created by Timur Tokaev (@toombez)

About

A library for creating and manipulating various color spaces

https://toombez.github.io/coloretic/

License:MIT License


Languages

Language:TypeScript 100.0%