GithubHelp home page GithubHelp logo

isabella232 / chartjs-color-string Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chartjs/chartjs-color-string

0.0 0.0 0.0 33 KB

Parser and generator for CSS color strings

License: MIT License

JavaScript 100.00%

chartjs-color-string's Introduction

chartjs-color-string

npm Travis

library for parsing and generating CSS color strings.

Install

With npm:

$ npm install color-string

Usage

Parsing

colorString.getRgb("blue")                       // [0, 0, 255]
colorString.getRgb("#FFF")                       // [255, 255, 255]
colorString.getRgba("#FFFA")                     //[255, 255, 255, 0.67]}
colorString.getRgba("#FFFFFFAA")                 // [255, 255, 255, 0.67]}

colorString.getRgba("rgba(200, 60, 60, 0.3)")    // [200, 60, 60, 0.3]
colorString.getRgba("rgb(200, 200, 200)")        // [200, 200, 200, 1]

colorString.getHsl("hsl(360, 100%, 50%)")        // [360, 100, 50]
colorString.getHsla("hsla(360, 60%, 50%, 0.4)")  // [360, 60, 50, 0.4]

colorString.getAlpha("rgba(200, 0, 12, 0.6)")    // 0.6

Generation

colorString.hexString([255, 255, 255])   // "#FFFFFF"
colorString.hexString([0, 0, 255, 0.4])    // "#0000FF66"
colorString.hexString([0, 0, 255], 0.4)    // "#0000FF66"
colorString.rgbString([255, 255, 255])   // "rgb(255, 255, 255)"
colorString.rgbString([0, 0, 255, 0.4])  // "rgba(0, 0, 255, 0.4)"
colorString.rgbString([0, 0, 255], 0.4)  // "rgba(0, 0, 255, 0.4)"
colorString.percentString([0, 0, 255])   // "rgb(0%, 0%, 100%)"
colorString.keyword([255, 255, 0])       // "yellow"
colorString.hslString([360, 100, 100])   // "hsl(360, 100%, 100%)"

chartjs-color-string's People

Contributors

ben-eb avatar dy avatar etimberg avatar harthur avatar ianstormtaylor avatar kevingorski avatar loicbourgois avatar mattdesl avatar moox avatar simonbrunel avatar tannerlinsley avatar treehousetim avatar victorteokw avatar zenflow 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.