color-fns
Modern JavaScript color utility library.
Last updated 6 years ago by abdelrahman3d .
MIT · Original npm · Tarball · package.json
$ npm install color-fns 
SYNC missed versions from official npm registry.

Build Status codecov Codacy Badge


Modern and Modular JavaScript color utility library. inspired by date-fns.

Features

  • Written in TypeScript. 😎
  • Lightweight. 💸
  • Modular and Tree-shakable.🌳
  • Multi-Color Model Support. 🎨
  • CSS compatible output. 💨

Installation

# yarn
yarn add color-fns

# npm
npm i color-fns

OR

<script src="https://unpkg.com/color-fns"></script>

Usage

// ES2015 (ES6)
import { toRgb } from 'color-fns';

console.log(toRgb('#fff'));


// CommonJS
const { toRgb } = require('color-fns');
console.log(toRgb('#fff'));

// UMD (Script Tag)
console.log(ColorFns.toRgb('#fff'));

Available Functions

Parsing

  • parseCmyk
  • parseHex
  • parseHsl
  • parseHsv
  • parseRgb

Conversion

  • cmykToRgb
  • hexToRgb
  • hslToRgb
  • hsvToRgb
  • rgbToCmyk
  • rgbToHex
  • rgbToHsl
  • rgbToHsv
  • toCmyk
  • toHex
  • toHsl
  • toHsv
  • toRgb

Operations

  • mix

Format and Display

  • expandHexShorthand
  • formatCmyk
  • formatHex
  • formatHsl
  • formatHsv
  • formatRgb

Validation

  • isValidCmyk
  • isValidHex
  • isValidHsl
  • isValidHsv
  • isValidRgb

Querying

  • whichModel
  • constrastInfo
  • isDark

Calculations

  • relativeLuminance

Contribution

Contributions are welcomed, however make sure you read the contribution guide and the code of conduct before making any pull requests.

License

MIT

Current Tags

  • 0.1.1                                ...           latest (5 years ago)

13 Versions

  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.10                                ...           6 years ago
  • 0.0.9                                ...           6 years ago
  • 0.0.8                                ...           6 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE