Git Product home page Git Product logo

chameleon's Introduction

Chameleon

Build Status

Chameleon is a utility that converts colors from one model to another. It currently supports: Hex, RGB, CMYK, HSL, Pantone, and Keywords.

Use

Conversion requires an input color struct, and an output color model. Example: Chameleon.convert(Chameleon.Hex.new("FFFFFF"), Chameleon.Rgb) -> %Chameleon.Rgb{r: 255, g: 255, b: 255}

If a translation cannot be made, the response will be an error tuple with the input value returned. Example: Chameleon.Color.convert(Chameleon.Hex.new("F69292"), Chameleon.Pantone) -> {:error, "No keyword match could be found for that hex value."}

In this example, there is no pantone value that matches that hex value, but an error could also be caused by a bad input value; Example: Chameleon.convert(Chameleon.Keyword.new("Reddish-Blue", Chameleon.Hex)

Caveat(s)

Pantone is designed to be used on printed work only. As such, it is disingenuous to say a pantone value can be translated to a hex value since hex values will look different depending on the device displaying them. However, if you have a pantone value and want to find a device-displayable analog, this library will work.

Installation

The package can be installed by adding chameleon to your list of dependencies in mix.exs:

def deps do
  [
    {:chameleon, "~> 2.0.0"}
  ]
end

Contribution

Contributions are welcomed. Please open a pull request or file an issue with your ideas. Some ideas would be:

  • add a new color model for conversion
  • add functionality to generate complementary colors
  • handle errors for invalid input values

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.