Coder Social home page Coder Social logo

bluwy / colorblind Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 2.0 97 KB

A zero-dependencies color blindness simulation library

Home Page: https://bluwy.github.io/colorblind

License: MIT License

JavaScript 12.43% TypeScript 87.57%
color-blindness-simulation color-deficiencies

colorblind's Introduction

colorblind's People

Contributors

bluwy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

colorblind's Issues

The data ranges of r,g & b should be greater than 0

target color '#0471BF' to rgb is {r: 4, g: 113, b: 191}.

call simulate({r: 4, g: 113, b: 191}, 'tritanopia'); we get {r: -5.937106516730836, g: 122.83507409286086, b: 122.83507308896952}. r is less than 0;

if we transform the data to hex like

const hexText = `#${((1 << 24) + (Math.round(r) << 16) + (Math.round(g) << 8) + Math.round(b)).toString(16).slice(1)}`;

will get an error result "#a7b7b".

better to set r = Math.max(r, 0); g = Math.max(g, 0); b = Math.max(b, 0) to the convert functions.

ps1: in css of chrome background-color: rgb(-6, 123, 123); equal to background-color: rgb(0, 123, 123)
ps2: I think the matrix from paper of color blind is not so perfect

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.