Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@asamuzakjp/css-color
Advanced tools
Resolve, parse, convert CSS color.
npm i @asamuzakjp/css-color
import { convert, parse, resolve } from '@asamuzakjp/css-color';
const rgb = resolve('color-mix(in srgb, red, blue)');
// 'rgb(128, 0, 128)'
const xyz = parse('lab(46.2775% -47.5621 48.5837)');
const hex = convert.xyzToHex(xyz);
// '#008000'
Resolve CSS color.
color
string color value
opt
object? options
Returns (string? | Array) rgba?()
, [r, g, b, a]
, #rrggbb(aa)?
, null
, or if key
is specified, [key, rgba?()|[r, g, b, a]|#rrggbb(aa)?|null]
rgb
, r
, g
, b
values are rounded.array
, values are floats.hex
, transparent
keyword resolves as null
, currentcolor
as #000000
if opt.currentColor
not specified.hexAlpha
, transparent
keyword resolves as #00000000
, currentcolor
as #00000000
if opt.currentColor
not specified.Parse CSS color.
value
string color value
color-mix()
and <system-color>s are not supportedopt
object? options
opt.d50
boolean? get xyz values in d50 white pointReturns Array<number> [x, y, z, a]
x|y|z|a: 0..1
Contains conversion functions as properties.
Convert xyz to hex color notation.
Returns string #rrggbbaa
Convert xyz to hsl color array.
Returns Array<number> [h, s, l, a]
h: 0..360 s|l: 0..100 a: 0..1
Convert xyz to hwb color array.
Returns Array<number> [h, w, b, a]
h: 0..360 w|b: 0..100 a: 0..1
Convert xyz to oklab color array.
Returns Array<number> [l, a, b, A]
l|A: 0..1 a|b: -0.4..0.4
Convert xyz to oklch color array.
Returns Array<number> [l, c, h, a]
l|a: 0..1 c: 0..0.4 h: 0..360
Convert xyz to rgb color array.
Returns Array<number> [r, g, b, a]
r|g|b: 0..255 a: 0..1
Convert xyz to xyz-d50 color array.
Returns Array<number> xyz - [x, y, z, a]
x|y|z|a: 0..1
Convert xyz-d50 to lab color array.
Returns Array<number> [l, a, b, A]
l: 0..100 a|b: -125..125 A: 0..1
Convert xyz-d50 to lch color array.
Returns Array<number> [l, c, h, a]
l: 0..100 c: 0..150 h: 0..360 a: 0..1
Copyright (c) 2024 asamuzaK (Kazz)
FAQs
CSS color - Resolve and convert CSS colors.
The npm package @asamuzakjp/css-color receives a total of 272,864 weekly downloads. As such, @asamuzakjp/css-color popularity was classified as popular.
We found that @asamuzakjp/css-color demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.