Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@kurkle/color
Advanced tools
The @kurkle/color npm package is designed for color manipulation and conversion. It provides a set of tools for parsing colors, converting them between different formats (e.g., HEX, RGB, HSL), and manipulating their properties (e.g., brightness, alpha). This package can be particularly useful in web development, data visualization, and any application where color manipulation is required.
Parsing and converting colors
This feature allows the parsing of color strings in various formats and their conversion into other formats. The example demonstrates converting an RGB color to its hexadecimal representation.
"const {color} = require('@kurkle/color');\nconst col = color('rgb(255, 99, 132)');\nconsole.log(col.hexString()); // Outputs: '#FF6384'"
Manipulating color properties
This feature enables the manipulation of color properties such as lightness. The example shows how to make a color lighter by a certain percentage.
"const {color} = require('@kurkle/color');\nconst col = color('hsl(100, 50%, 50%)').lighten(0.2);\nconsole.log(col.hslString()); // Outputs a lighter HSL color string"
Alpha transparency manipulation
This feature allows for the manipulation of the alpha transparency of a color. The example demonstrates changing the alpha value of an RGBA color.
"const {color} = require('@kurkle/color');\nconst col = color('rgba(255, 99, 132, 0.5)').alpha(0.75);\nconsole.log(col.rgbaString()); // Outputs an RGBA color string with updated alpha"
chroma-js is a powerful library for all kinds of color conversions and color scales. Compared to @kurkle/color, chroma-js offers a broader range of color manipulation capabilities, including color scales, interpolation, and more complex transformations.
The 'color' package provides similar functionalities for color parsing, conversion, and manipulation. It supports a wide range of color models. Compared to @kurkle/color, it might offer a slightly different API and additional color models.
tinycolor2 is a small, fast library for color manipulation and conversion in JavaScript. It offers functionality similar to @kurkle/color but with a focus on simplicity and minimal footprint. It might be preferred for projects where size is a critical factor.
Fast and small CSS color parsing and manipulation library.
Supported formats:
blue
transparent
#aaa
#bbba
#1A2b3c
#f1f2f388
rgb(255, 255, 255)
rgb(255, 0, 0, 0.5)
rgb(50%, 50%, 50%, 50%)
rgb(0 0 100% / 80%)
rgba(200, 20, 233, 0.2)
rgba(200, 20, 233, 2e-1)
hsl(240deg, 100%, 50.5%)
hsl(0deg 100% 50%)
hsla(12, 10%, 50%, .3)
hsla(-1.2, 10.2%, 50.9%, 0.4)
hwb(240, 100%, 50.5%)
hwb(244, 100%, 100%, 0.6)
hsv(240, 100%, 50.5%)
hsv(244, 100%, 100%, 0.6)
@kurkle/color
is available under the MIT license.
FAQs
css color parsing, manupulation and conversion
The npm package @kurkle/color receives a total of 1,657,055 weekly downloads. As such, @kurkle/color popularity was classified as popular.
We found that @kurkle/color 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.