GithubHelp home page GithubHelp logo

brendanberkley / colorsys Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netbeast/colorsys

0.0 2.0 0.0 12 KB

Bidirectional color convertor for RGB, HSL, HSV and HEX

Home Page: http://netbeast.co

License: MIT License

JavaScript 100.00%

colorsys's Introduction

colorsys

Colorsys is a simple javascript color conversion library that allows conversion between RGB, HSL, HSV and HEX

install

With npm

npm install colorsys

Load on browser or copy paste into your code

<script src="http://netbeast.github.io/colorsys/browser.js"></script>

api

the input parameter could be an object ({r: 50, g: 100, b: 0}) or 3 integers (50, 100, 0)

colorsys.rgb_to_hsl({ r: 255, g: 255, b: 255 }) => { h: 0 , s: 0 , l: 100 }

aliases: rgbToHsl, rgb2Hsl

colorsys.rgb_to_hsv({ r: 255, g: 255, b: 255 }) => { h: 0 , s: 0 , v: 100 }

aliases: rgb2Hsv, rgbToHsv

colorsys.hsl_to_rgb({ h: 0 , s: 0 , l: 100 }) => { r: 255, g: 255, b: 255 }

aliases: hsl2Rgb, hslToRgb

colorsys.hsv_to_rgb({ h: 0 , s: 0 , v: 100 }) => { r: 255, g: 255, b: 255 }

aliases: hsv2Rgb, hsvToRgb

colorsys.rgb_to_hex({ r: 255, g: 255, b: 255 }) => '#ffffff'

aliases: rgb2Hex, rgbToHex

colorsys.hex_to_rgb('#ffffff') => { r: 255, g: 255, b: 255 }

aliases: hex2Rgb, hexToRgb

colorsys.hsv_to_hex({ r: 255, g: 255, b: 255 }) => '#ffffff'

aliases: hsv2Hex, hsvToHex

colorsys.hex_to_hsv('#ffffff') => {h: 0 , s: 0 , v: 100 }

aliases: hex2Hsv, hexToHsv

colorsys.hsl_to_hex({r: 255, g: 255, b: 255}) => '#ffffff'

aliases: hsl2Hex, hslToHex

colorsys.hex_to_hsl('#ffffff') => {h: 0 , s: 0 , l: 100 }

aliases: hex2Hsl, hexToHsl

example

var colorsys = require('colorsys')

colorsys.hex_to_hsv('#ffffff')    //  { h: 0, s: 0, v: 100 }

colorsys.rgb_to_hsv({r: 255, g: 255, b: 255 }) => { h: 0 , s: 0 , v: 100 }

There are some formats missing like YIQ, HWB, CMYK, ansii and ansi16. Please help us to complete this library making a pull request.

Contact

This repo is shared with ❤️ from Netbeast IoT regular job translating messages from different devices and aggregating data.

colorsys's People

Contributors

pablopi avatar brendanberkley avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.