Socket
Socket
Sign inDemoInstall

color-fns

Package Overview
Dependencies
0
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    color-fns

Modern JavaScript color utility library.


Version published
Weekly downloads
7.6K
decreased by-17.47%
Maintainers
2
Install size
99.1 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 23 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc