Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@swiftcarrot/color-fns

swiftcarrot121.3kMIT3.2.0

color functions for node and browser

color, css, functions, parse, parser, utilities

readme

@swiftcarrot/color-fns

npm npm Build Status codecov styled with prettier

Color functions for node and browser

Installation

npm install @swiftcarrot/color-fns --save
yarn add @swiftcarrot/color-fns

Usage

// commonjs
const { hex2rgb } = require('@swiftcarrot/color-fns');

// es module
import { hex2rgb, cssColor } from '@swiftcarrot/color-fns';
import * as fns from '@swiftcarrot/color-fns';

Available functions

  • cssColor: parse a valid css color value to rgba format
  • hex2hsl
  • hex2hsv
  • hex2rgb
  • hsl2hsv
  • hsl2rgb
  • hsv2hex
  • hsv2hsl
  • hsv2rgb
  • rgb2hex
  • rgb2hsv
  • rgba
  • rgba2hex
  • rgba2rgb

check test for more examples

License

MIT

changelog

Changelog

[Unreleased]

[3.2.0]

  • add hex2hsv

[3.1.2]

  • add h=360 support to hsv/hsl

[3.1.1]

  • fix missing dependency @babel/runtime

[3.1.0]

  • add hex2alpha

[3.0.0]

Changed

  • hex color string now starts with #