
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
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
The npm package css-gradient-parser receives a total of 125,864 weekly downloads. As such, css-gradient-parser popularity was classified as popular.
We found that css-gradient-parser 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.