imretro / color-ts

Color util library

Home Page:https://imretro.github.io/color-ts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@imretro/color

npm CI codecov

Color util library

This library provides some simple utilities for representing colors.

Example

import { Grayscale, RGBA } from '@imretro/color';

const black = new Grayscale(0);
console.log(black.r, black.g, black.b, black.a); // 0 0 0 255

const transparentGreen = new RGBA(0, 255, 0, 127);
console.log(transparentGreen.hex); // #00FF00
console.log(`${Math.round(transparentGreen.opacity * 100)}%`); // 50%

About

Color util library

https://imretro.github.io/color-ts/

License:MIT License


Languages

Language:TypeScript 91.3%Language:JavaScript 8.7%