Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@theodorejb/color-detect
Advanced tools
Convert CSS color strings to RGBA and check whether they are light or dark
Convert color strings to an RGBA array, and determine if the color is light or dark.
npm install @theodorejb/color-detect --save
import {colorToRgba, isLightColor, rgbaToCssString} from '@theodorejb/color-detect';
// convert CSS colors to an RGBA array
colorToRgba('red'); // [255, 0, 0, 255]
colorToRgba('#123'); // [17, 34, 51, 255]
colorToRgba('rgb(80, 160, 240)'); // [80, 160, 240, 255]
// detect whether a color is light or dark
isLightColor(colorToRgba('red')); // true
isLightColor(colorToRgba('#663399')); // false
isLightColor(colorToRgba('yellow')); // true
isLightColor(colorToRgba('lime')); // true
isLightColor(colorToRgba('green')); // false
// convert an RGBA array to CSS color string
let chocolateRgb = colorToRgba('chocolate');
rgbaToCssString(chocolateRgb); // "rgba(210, 105, 30, 1)"
Theodore Brown
https://theodorejb.me
MIT
[2.0.0] - 2022-11-20
colorLuminance()
function which implements the W3C algorithm to determine a color's relative luminance.colorToRgbaArray()
to simply colorToRgba()
.isLightColor()
now correctly follows W3C algorithm for comparing color contrast.FAQs
Convert CSS color strings to RGBA and check whether they are light or dark
The npm package @theodorejb/color-detect receives a total of 402 weekly downloads. As such, @theodorejb/color-detect popularity was classified as not popular.
We found that @theodorejb/color-detect 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
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.