![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@bjornlu/colorblind
Advanced tools
A zero-dependencies color blindness simulation library.
It is based on the color blindness simulation research and its Processing library by hx2A.
$ npm install @bjornlu/colorblind
or with CDN for direct browser usage, such as:
<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/@bjornlu/colorblind"></script>
<!-- unpkg -->
<script src="https://unpkg.com/@bjornlu/colorblind>"></script>
The CDN version sets a global colorblind
object, e.g. colorblind.simulate(...)
.
import { simulate } from '@bjornlu/colorblind'
simulate({ r: 120, g: 50, b: 30 }, 'protanopia')
// => { r: 62, g: 62, b: 30 }
The color deficiency can be set to:
Deficiency | Description |
---|---|
'protanopia' | No red |
'deuteranopia' | No green |
'tritanopia' | No blue |
'achromatopsia' | No color |
The library also exports two functions:
simulateDichromatic(rgb: RGB, simMatrix: Array<number>): RGB
simulateMonochromatic(rgb: RGB, simMatrix: Array<number>): RGB
You would almost never used this unless you need to perform custom color simulation.
simulateDichromatic()
accepts a simulation matrix represented as an array of 9 numbers, while simulateMonochromatic()
accepts array of 3 numbers.
Check out the research for how to calculate simulation matrices.
PRs are welcomed for any typos or documentation issues. Edits on the simulation algorithm must be backed up with research and is preferred to be discussed in an issue first.
The library was actually planned to be a rewrite of color-blind to remove the onecolor dependency and to add typings. In the process of understanding how the code works, I found that the original reference was outdated and has a newer version.
I also found out about the LMS version of the daltonize implementation, which happens to be the same technique used in the color blindness simulation research. The only difference was the simulation matrix used for the color deficiencies and its post color correction calculations.
I finally decided to follow the algorithm from the research since it's the only source I found that backs up how the values were calculated. So this means that this library does not use daltonization to calculate the colors.
Since I'm no expert in this field, I would highly appreciate validation on the implementation and whether daltonization would be the better choice.
MIT
1.0.3 - 2020-10-22
FAQs
Simulate color blindness
The npm package @bjornlu/colorblind receives a total of 12 weekly downloads. As such, @bjornlu/colorblind popularity was classified as not popular.
We found that @bjornlu/colorblind demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.