Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
color-forge
Advanced tools
npm install color-brewer
A simple color system based on the work of https://github.com/dfcreative/color-space
Colors can be made with the regular constructor pattern.
var color = new Color([255, 0, 0], 'rgb');
or
var color = Color.rgb([255, 0, 0]);
In addition, you can create a color from a hex code as follows.
Color.hex('#123');
Color.hex('123');
Color.hex('#112233');
Color.hex('112233');
See color-space for supported color spaces (it's pretty much all of them).
The format of a color object is as follows.
color {
space,
values
[semi-private] originalColor
}
color.convert('lab');
The result is a new object, and does not affect the original object. Additionally, the new object will store the original color, meaning unlimited conversions without loss.
assert.deepEqual(
color.convert('lab').convert('hsl').convert('rgb').convert('xyz').values,
color.convert('xyz').values
);
color1.mix(color2, [amount = 0.5, [mode = 'rgb']]);
Returns a new color object with the colors mixed according to amount (an amount of 0 gives color1, and 1 gives color2). Specifying a different mode will mix the color via that mode, allowing you to get even color spaces.
color1.mix(color2, 0.5, 'lab');
color1.add(color2);
All operations accept a color as the first and only argument. The available color operations are add
, subtract
, multiply
, divide
, screen
, overlay
, dodge
, burn
.
All operations are done via RGB.
color1.toString() // Gives a string like 'hsl(180, 60, 20)'
color1.toHex() // Gives the hex code
FAQs
A simple color system based on the work of https://github.com/dfcreative/color-space
The npm package color-forge receives a total of 2 weekly downloads. As such, color-forge popularity was classified as not popular.
We found that color-forge 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
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.