Giter VIP home page Giter VIP logo

jscolor's Introduction

jscolor

Super simple color manipulation using getters and setters

Install:

npm install --save jscolor

Usage:

import Color from 'jscolor'

let c = new Color('#483d8b')

Read color values without any extra work:

c.r           // => 72
c.g           // => 61
c.b           // => 139
c.a           // => 1
c.red         // => 72
c.green       // => 61
c.blue        // => 139
c.alpha       // => 1
c.rgb         // => 'rgb(72,61,139)'
c.rgba        // => 'rgba(72,61,139,1)'
c.h           // => 248
c.s           // => 39
c.l           // => 39
c.hue         // => 248
c.saturation  // => 39
c.lightness   // => 39
c.hsl         // => hsl(248,39%,39%)
c.hsla        // => hsla(248,39%,39%,1)
c.hex         // => '#483d8b'
c.yiq         // => 73.181
c.name        // => 'darkslateblue'

Manipulate colors using normal operators:

c.r = 100
c.rgb         // => 'rgb(100,61,139)'
c.hex         // => '#643d8b'

c.hue += 180
c.rgb         // => 'rgb(129,139,61)'
c.hex         // => '#648b3d'

c.rgb = 'rgb(150,170,180)'
c.hsl         // => 'hsl(200,17%,65%)'
c.hex         // => '#96aab4'

jscolor's People

Stargazers

 avatar  avatar  avatar

Watchers

 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.