
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
css-gradient-parser
Advanced tools
The css-gradient-parser is a JavaScript library that allows you to parse CSS gradient strings into a structured format. This can be useful for applications that need to manipulate or analyze CSS gradients programmatically.
Parse CSS Gradient Strings
This feature allows you to parse a CSS gradient string into an object that represents the gradient's structure. The code sample demonstrates how to use the `parse` function to convert a linear gradient string into a structured format.
const { parse } = require('css-gradient-parser');
const gradient = 'linear-gradient(to right, red, blue)';
const parsedGradient = parse(gradient);
console.log(parsedGradient);
The gradient-parser package is similar to css-gradient-parser in that it also parses CSS gradient strings into a structured format. However, gradient-parser is more widely used and has a more extensive set of features for handling different types of gradients.
The css-gradient package provides utilities for working with CSS gradients, including parsing and generating gradient strings. It offers a broader range of functionalities compared to css-gradient-parser, such as generating gradient strings from objects.
This lib intends to give a parser for satori so that we can handle more gradient features
parseLinearGradient
interface LinearOrientation {
type: 'directional' | 'angular'
value: string
}
interface LinearResult {
orientation: LinearOrientation
repeating: boolean
stops: Array<{
color: string
offset: string
hint?: string
}>
}
parseRadialGradient
type ValueType = 'keyword' | 'length'
interface RadialResult {
shape: 'circle' | 'ellipse'
repeating: boolean
size: {
type: ValueType
value: string
}[]
position: {
x: { type: ValueType, value: string }
y: { type: ValueType, value: string }
}
stops: ColorStop[]
}
parseConicGradient
type RectColorSpace = 'srgb' | 'srgb-linear' | 'lab' | 'oklab' | 'xyz' | 'xyz-d50' | 'xyz-d65'
type PolarColorSpace = 'hsl' | 'hwb' | 'lch' | 'oklch'
type HueInterpolationMethod = `${'shorter' | 'longer' | 'increasing' | 'decreasing'} hue`
interface ConicGradient {
angle: string
repeating: boolean
position: string
color?: Color
stops: Array<{
color: string
offset: string
hint?: string
}>
}
type Color = {
space: RectColorSpace | PolarColorSpace
method?: HueInterpolationMethod
}
FAQs
a css gradient parser
The npm package css-gradient-parser receives a total of 164,654 weekly downloads. As such, css-gradient-parser popularity was classified as popular.
We found that css-gradient-parser demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.