Giter Club home page Giter Club logo

chroma's Introduction

Chroma - Everything you want to do with colors.

Docs: https://treeform.github.io/chroma/

Parse/Format

Common color parsers and formatters:

  • hex - FFFFFF
  • HtmlHexTiny - #FFF
  • HtmlHex - #FFFFFF
  • HtmlRgb - rgb(255, 255, 255)
  • HtmlRgba - rgba(255, 255, 255, 1.0)
  • HtmlName - white
  • HexAlpha - FFFFFFFF
  • parseHtmlColor - Any of the HTML formats.

Color Spaces

Conversion from and to these colors spaces:

  • 8-bit RGB
  • 8-bit RGBA
  • CMY colors are reverse of rgb
  • CMYK colors are used in printing
  • HSL attempts to resemble more perceptual color models
  • HSV models the way paints of different colors mix together
  • YUV origially a television color format, still used in digital movies

Color Functions

You can use these to change colors you already have

  • lighten(color, amout) Lightens the color by amount 0-1
  • darken(color, amout) Darkens the color by amount 0-1
  • saturate(color, amout) Saturates (makes brighter) the color by amount 0-1
  • desaturate(color, amout) Desaturate (makes grayer) the color by amount 0-1
  • spin(color, degrees) Rotates the hue of the color by degrees (0-360)
  • mix(colorA, colorB) Mixes two colors together using CMYK

Example

import chroma

let
    a = color(0.7,0.8,0.9)
    b = color(0.2,0.3,0.4,0.5)

echo a.toHex()
echo parseHex("BADA55")
echo parseHtmlName("red")
echo hsv(b).color()
echo a.darken(0.2)
echo mix(a, b)

chroma's People

Contributors

narimiran avatar treeform avatar

Watchers

 avatar  avatar  avatar

Forkers

schmick6

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.