
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
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: ColorStop[]
}
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: ColorStop[]
}
type Color = {
space: RectColorSpace | PolarColorSpace
method?: HueInterpolationMethod
}
FAQs
a css gradient parser
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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.