Git Product home page Git Product logo

color's Introduction

color

Used to convert colors to RGB or hex from RGB, hex or the color name

Simply run any of the functions (toArray, toRgb, toHex or toName) and pass it your color in any of the following formats.

  • Array - [25, 10, 255]
  • RGB - rgb(25, 10, 255)
  • Hex - #FFC609
  • Name - red

The method will then return the color converted to either an array, rgb, hex or its name equivilent depending on what method you ran.

You also have access to all of the colors and their values by name. For instance, the following code will return [255, 0, 0]

color.names.red;

To then convert that into hex you would use the following line.

color.toHex(color.names.red);

Installation

You can find this library on npm under olical-color or on the unpkg CDN at https://unpkg.com/olical-color/src/color.js. It is distributed with a UMD wrapper, so you can use it via AMD, nodejs or a browser global.

Testing

Simply execute npm test to run the tape tests and npm run lint to run the standard linter. They are all executed before a publish.

Author

Oliver Caldwell (@OliverCaldwell)

Unlicenced

Find the full unlicense in the UNLICENSE file, but here's a snippet.

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Do what you want. Learn as much as you can. Unlicense more software.

color's People

Contributors

olical avatar pypmannetjies 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.