Code Monkey home page Code Monkey logo

color-palette's Introduction

color-palette

Build Status Dependency Status devDependency Status

Description

color-palette is a command line tool that uses phantomjs and color-thief to get a color palette from a website or an image. Any resource that can be opened in phantomjs can be used.

Installation

Install the command line tool globally by running:

npm install -g color-palette

Usage

Usage: color-palette [options] <resource>

Options

-h, --help               output usage information
-v, --version            output the version number
-s, --size <size>        the target size of the color palette (might return +/- 2)
-q, --quality <quality>  the quality of the colors (0 is highest, 10 is default)
-i, --image              add image to output
-o, --output [type]      specify the output type: text, json, or html

Examples

Get a color palette for google.com

$ color-palette http://google.com
      Resource: http://google.com
       Success: true
Dominant Color: #2d2f2e
       Palette: #dcd7d2,#2b2b2b,#2a5fe3,#d94835,#30a28f,#7a7a7a,#049451

Get a color palette for amazon.com, output should be in json format

$ color-palette -o json http://amazon.com
{
  "resource": "http://amazon.com",
  "uri": "http://amazon.com",
  "success": true,
  "dominantColor": "#253a4f",
  "palette": [
    "#24364b",
    "#dadbda",
    "#84454a",
    "#c38f3d",
    "#758b9d",
    "#ad8989",
    "#2ea9c3"
  ]
}

Get an html report for amazon.com and open it

$ color-palette -o html http://amazon.com > output.html & open output.html

# alternative version if you're using OSX w/ homebrew `brew install browser`:
$ color-palette -o html http://amazon.com > output.html | browser

Get a color palette for reddit.com, include a screenshot in the json output

color-palette -i -j http://reddit.com > output.json

NOTE: when including the image switch, the output is very large due to the base64 encoded image data uri

See Also

  • Color Thief - This is the library that I use to get palette information in the color-palette cli.
  • Pictaculous - Upload an image and get it's palatte. They provide a free api as well. At some point I might integrate this API into the color-palette cli.
  • url2png - An API for taking screenshots of websites. Currently, I'm using phantomjs for taking screenshots, but combining the url2png and pictaculous APIs would be an alternative to using color-palette.

License

Copyright (c) 2014 skratchdot
Licensed under the MIT license.

color-palette's People

Contributors

skratchdot avatar

Watchers

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