Giter Site home page Giter Site logo

rgb-lab's Introduction

RGB-LAB

So it turns out that comparing the difference between RGB colors is actually a really shitty way to determine color distance. There are colors which have similar RGB representations while being perceptually distant, and perceptually similar colors with vastly different representations.

So I decided to run a series of large scale double-blind (heh) experiments on human perception, analyzing the output with a dizzying array of statistical techniques and-- oh wait, no I didn't, because scientists have gotten that all figured out since the late '70s.

rgb2lab([r, g, b])

The first function is rgb2lab, it does kind of exactly what you'd expect, making the usual sRGB assumptions.

lab2rgb([l, a, b])

The second one is lab2rgb, and it's kind of the inverse of lab2rgb. That is, in an ideal world, you could expect that lab2rgb(rgb2lab([a, b, c])) would return [a, b, c], which probably won't be the case due to quirks of floating point arithmetic.

But if you feed functions values which lie squarely within the acceptable range (R, G, B between 0 and 255), things should be okay.

deltaE([labA], [labB])

This function calculates DeltaE, the perceptual color distance between any two random colors in the Lab* space.

rgb-lab's People

Contributors

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