Extract prominent colors from an image. JS port of Android's Palette.

Related tags

Color palette
Overview

Vibrant.js

Extract prominent colors from an image. Vibrant.js is a javascript port of the awesome Palette class in the Android support library.

⚠️ THIS REPO IS DEPRECATED ⚠️

Please file issues over on the node-vibrant repo, this repo is kept solely for historical reasons, but ongoing development will happen over there. Despite node-vibrant's name, it works with both node and the browser (with and without UMD support). It is highly recommended you use that project over this one.

Link to node-vibrant

Demo & usage docs

See the website: http://jariz.github.io/vibrant.js/

Installing

Bower

bower install vibrant

Download

See our releases

npm

npm install node-vibrant
This is a node compatible version made by AKFish, more info & docs.

Building

  1. npm install
  2. bower install
  3. Compile gulpfile: coffee -c gulpfile.coffee
  4. gulp
  5. Done. Optionally run gulp watch for automatic compiling.

Other cool stuff

Check out Tabbie, the fully customisable material new tab page, with all your favorite websites and services!

Comments
  • UMD / Publish to npm

    UMD / Publish to npm

    Hi friend!

    I'm working on getting this into my project (as it is the missing link to getting working; thank you so much!) and I noticed it's not published to npm. I'll probably work it so I can use it personally as an npm module; do you have any interest in using the UMD format so that your module can be consumed by both Bower and npm users?

    opened by btholt 9
  • Black & white (grayscale?) image generates palette with colors

    Black & white (grayscale?) image generates palette with colors

    Hi, default params with this image: https://www.facebook.com/photo.php?fbid=10107296866472911&l=bb741fb5ef

    Generates these results:

    screen shot 2015-08-07 at 4 45 01 pm

    It would be nice to auto detect if an image is B&W and only generate a palette on the grayscale.

    opened by rayshan 6
  • canvas added in the body

    canvas added in the body

    I'am using vibrant.js with angular 4 , and exprience an issues that the canvas didn't removed from the body image and i call it like that `

    let v = new Vibrant(changes.toPlayRadio.currentValue.pic);
    v.getPalette((err, palette) => {
      var rgb = palette.Vibrant.getRgb()
      this.radioBackground =
      {
        'background' : 'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+');'
      }
    });
    

    `

    opened by amirping 5
  • Color post processing?

    Color post processing?

    Hello!

    While watching the I/O's "Material now" presentation this year I've noticed that from an album art they got the primary/accent color using Palette.

    mac miller

    When I tried to do the same using vibrant.js the colors they got are nowhere to be found.

    mac miller 2

    Is it just a further post processing provided by the player app or should vibrant.js return the right colors using the Material Pelette?

    opened by Pupix 5
  • Demo not working in Safari or Firefox

    Demo not working in Safari or Firefox

    Trying out vibrant.js in the jsfiddle on the webpage fails, returning the follow error: /TypeError: cmap.vboxes is undefined

    Edit: just noticed the disclaimer regarding image dropping only working in Chrome. Why is this the case?

    opened by sgwilym 4
  • [bug] global variable

    [bug] global variable "index"

    hello, i find vibrant.js will set a global variable index

    https://github.com/jariz/vibrant.js/blob/master/dist/Vibrant.js#L143

    i think this can fix it

    // https://github.com/jariz/vibrant.js/blob/master/dist/Vibrant.js#L134-L152
            count: function(force) {
                var vbox = this,
                    histo = vbox.histo;
                if (!vbox._count_set || force) {
                    var npix = 0,
                        i, j, k, index;  // add index here
                    for (i = vbox.r1; i <= vbox.r2; i++) {
                        for (j = vbox.g1; j <= vbox.g2; j++) {
                            for (k = vbox.b1; k <= vbox.b2; k++) {
                                index = getColorIndex(i, j, k);
                                npix += (histo[index] || 0);
                            }
                        }
                    }
                    vbox._count = npix;
                    vbox._count_set = true;
                }
                return vbox._count;
            },
    

    sorry that i don not know coffee js

    opened by LoeiFy 4
  • Resize images before running quanitizer, like the real Palette does.

    Resize images before running quanitizer, like the real Palette does.

    Currently, the demo site is a pretty good example for this: if you change the size of your browser, the palette will change. This is of course caused by the image size changing, and because of Vibrant not loading every single pixel (only the 5th, each time, by default, as configured by the quality parameter)

    For more consistent results, Vibrant should resize the image to a default set max size before getting swatches from it. Maybe even instead of grabbing every fifth pixel, it should grab every pixel when it's downscaled. (unless performance takes a hit)

    Palette does this as well.

    enhancement 
    opened by jariz 4
  • Cannot read property map of undefined

    Cannot read property map of undefined

    The current Vibrant release gives an error like this.

    Vibrant.js:651 Uncaught (in promise) TypeError: Cannot read property 'map' of undefined
        at new Vibrant (Vibrant.js:651)
        at workList.js:89
        at Array.forEach (<anonymous>)
        at workList.js:86
        at <anonymous>
    

    Where the code calling Vibrant is

    const image = new Image(200, 200);
                image.src = item.fields.image.fields.file.url;
                const vibrant = new Vibrant(image);
                const swatches = vibrant.swatches();
                alert(swatches[0].getHex());
    
    opened by randohinn 3
  • fix issue #20

    fix issue #20

    This PR addresses https://github.com/jariz/vibrant.js/issues/20 by updating the quantize dependency to point at the most recent version of the github repo (the fix was introduced in 1.0.2, which is not yet published to npm; https://github.com/olivierlesnicki/quantize/pull/1) and rebuilding.

    opened by jonathanzong 3
  • How to import Vibrant using jspm

    How to import Vibrant using jspm

    I'm including Vibrant in my project using JSPM. I get the following error Error: Error loading "quantize" at file:/path/to/project/folder/quantize.js

    Do you know what might be the issue?

    opened by jdwillemse 2
  • new Vibrant() on <img style= is a really bad idea">

    new Vibrant() on is a really bad idea

    Causes Firefox and Chrome to grind to a complete halt :\

    "But why would you hide the image that you're trying to accentuate I don't even what"

    I'm doing some dynamic styling in the browser and I was hoping to hide the image element itself, using it only as the source to script in a background-image with background-size: cover and dynamic background/text overlay color values (provided by Vibrant.js)

    But that's besides the point, checking the image dimensions or display properties before copying the image to a new canvas element might be a good idea idk

    Love the library, ran into this just now, thought I'd say something =)

    opened by dayvonjersen 2
  • Fill more empty swatches

    Fill more empty swatches

    Muted variations were not being filled if empty, this adds them so they're available from Vibrant. Also, try filling Vibrant from LightVibrant (if available). This fixes https://github.com/ismamz/postcss-get-color/issues/3 and https://github.com/akfish/node-vibrant/pull/51

    opened by Kronuz 0
Owner
Jari Zwarts
senior frontend @oberonamsterdam
Jari Zwarts
A simple Discord bot that will listen for HEX, RGB(a), and HSL(a) colors in a message, and provide a small image of that color.

Pigment For the teams of designers and developers out there - Pigment will listen for messages containing a HEX, RGB(a), or HSL(a) color, and provide

Conrad Crawford 17 Dec 8, 2022
A CLI utility to calculate/verify accessible magic numbers for a color palette.

A11y Contrast A CLI utility to calculate/verify accessible magic numbers for a color palette. Read my blog post for some more information. Installatio

Darek Kay 23 Nov 13, 2022
A tiny script for generating attractive colors

Random Color A tiny script for generating attractive random colors. See the demo for an explanation and some samples. randomColor has been ported to C

David Merfield 5.9k Dec 24, 2022
Smarter defaults for colors on the web.

colors.css 3.0.0 Better default colors for the web. A collection of skin classes for faster prototyping and nicer looking sites. Stats 903 85 85 bytes

murmurs 9.2k Jan 9, 2023
JavaScript Library for creating random pleasing colors and color schemes

#PleaseJS www.checkman.io/please Please.js is a polite companion that wants to help you make your projects beautiful. It uses HSV color space to creat

Jordan Checkman 2.3k Dec 22, 2022
Generate colors based on a desired contrast ratio

Generate colors based on a desired contrast ratio

Adobe, Inc. 1.4k Jan 3, 2023
get colors in your node.js console

colors.js This is a fork of Marak Squires' original colors.js project Please check out the roadmap for upcoming features and releases. Please open Iss

Josh 5 Jan 11, 2022
Node Terminal Colors. Fast!

Tcol npm package to add colors to your terminal Installation # npm npm install tcol # pnpm pnpm install tcol Usage import { c } from "tcol"; console.

Posandu 4 May 13, 2022
Get colors in your node.js console

@colors/colors ("colors.js") Please check out the roadmap for upcoming features and releases. Please open Issues to provide feedback. get color and st

David Hyde 89 Dec 30, 2022
A dependency-free image color extraction library

Color mage A dependency-free image color extraction library. The extraction consists of using K-Means algorithm. It has a few utility functions as wel

Gilmar Quinelato 4 Mar 11, 2022
An innovative new front-end for Ultraviolet that is prominent in both speed and looks

Lucid Proxy An open-source proxy using the Ultraviolet backend by TN, Lucids purpose is to end internet censorship. Self Host Features CAPTCHA and hCA

Astral Network 3 Dec 14, 2022
colors.js - get colors in your node.js console

colors.js Please check out the roadmap for upcoming features and releases. Please open Issues to provide feedback, and check the develop branch for th

cronlabspl 4 Feb 9, 2022
chakra-radix-colors provides radix-ui color palettes, automatic dark mode, and acessible colors to chakra-ui applications

chakra-radix-colors chakra-radix-colors provides radix-ui color palettes, automatic dark mode, and acessible colors to chakra-ui applications. About C

null 11 Dec 30, 2022
VSCode Serial Port Extension. You can connect any serial port used to read / write data.

Serial Port Helper You can connect any serial port used to read / write data. Features Serial Port View; Serial Port Config; TX / RX; Send Hex Buffer:

Hancel Lin 30 Sep 18, 2022
solid material ui port (ported from blazor port)

solid-material-ui solid material ui port (porting from blazor port) In preparation for solid hack Turbo Mono-repository is used for component package

skclusive 18 Apr 30, 2022
Grab the color palette from an image using just Javascript. Works in the browser and in Node.

Color Thief Grab the color palette from an image using just Javascript.Works in the browser and in Node. View the demo page for examples, API docs, an

Lokesh Dhakar 11.2k Dec 30, 2022
A simple Discord bot that will listen for HEX, RGB(a), and HSL(a) colors in a message, and provide a small image of that color.

Pigment For the teams of designers and developers out there - Pigment will listen for messages containing a HEX, RGB(a), or HSL(a) color, and provide

Conrad Crawford 17 Dec 8, 2022
optimize image & upload file to cloud as image bed with tiny image automic.

Rush! 图片压缩 & 直传图床工具 这是一个兴趣使然的项目, 希望 Rush! 能让这个世界的网络资源浪费减少一点点 下载 Downloads 获取最新发行版 功能 Features 拖拽批量压缩图片, 支持格式 jpg/png/gif Drop to optimize, jpg/png/gif

{ Chao } 3 Nov 12, 2022
a blue-ish gray with a purple accent color palette for Visual Studio Code.

Installation via VSCode Open Extensions sidebar panel in VS Code. View → Extensions Search for nightfall Click Install to install it Click Reload to r

nightfall 6 Dec 21, 2021
A CLI utility to calculate/verify accessible magic numbers for a color palette.

A11y Contrast A CLI utility to calculate/verify accessible magic numbers for a color palette. Read my blog post for some more information. Installatio

Darek Kay 23 Nov 13, 2022