Modern and Modular JavaScript color utility library. inspired by date-fns.
- Written in TypeScript. 😎
- Lightweight. 💸
- Modular and Tree-shakable.🌳
- Multi-Color Model Support. 🎨
- CSS compatible output. 💨
# yarn
yarn add color-fns
# npm
npm i color-fns
OR
<script src="https://unpkg.com/color-fns"></script>
// 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'));
- parseCmyk
- parseHex
- parseHsl
- parseHsv
- parseRgb
- cmykToRgb
- hexToRgb
- hslToRgb
- hsvToRgb
- rgbToCmyk
- rgbToHex
- rgbToHsl
- rgbToHsv
- toCmyk
- toHex
- toHsl
- toHsv
- toRgb
- mix
- expandHexShorthand
- formatCmyk
- formatHex
- formatHsl
- formatHsv
- formatRgb
- isValidCmyk
- isValidHex
- isValidHsl
- isValidHsv
- isValidRgb
- whichModel
- constrastInfo
- isDark
- hexFromName
- hexToName
- relativeLuminance
Contributions are welcomed, however make sure you read the contribution guide and the code of conduct before making any pull requests.
MIT