![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@csstools/convert-colors
Advanced tools
Convert colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
The @csstools/convert-colors npm package provides functionality for converting colors between different color models such as RGB, HSL, HWB, and more. It can be used to manipulate and convert color values in various formats, which is useful for web development and design tasks where precise color management is required.
RGB to HSL conversion
Converts an RGB color value to its equivalent HSL value.
const { rgb2hsl } = require('@csstools/convert-colors');
const hsl = rgb2hsl(255, 0, 0); // Convert red from RGB to HSL
HSL to RGB conversion
Converts an HSL color value to its equivalent RGB value.
const { hsl2rgb } = require('@csstools/convert-colors');
const rgb = hsl2rgb(0, 100, 50); // Convert red from HSL to RGB
RGB to HEX conversion
Converts an RGB color value to its equivalent HEX value.
const { rgb2hex } = require('@csstools/convert-colors');
const hex = rgb2hex(255, 0, 0); // Convert red from RGB to HEX
HEX to RGB conversion
Converts a HEX color value to its equivalent RGB value.
const { hex2rgb } = require('@csstools/convert-colors');
const rgb = hex2rgb('#ff0000'); // Convert red from HEX to RGB
HWB to RGB conversion
Converts an HWB color value to its equivalent RGB value.
const { hwb2rgb } = require('@csstools/convert-colors');
const rgb = hwb2rgb(0, 0, 0); // Convert black from HWB to RGB
A popular color conversion library that provides conversions between various color models. It has a similar range of functionalities as @csstools/convert-colors but with a different API and additional conversions like CMYK and ANSI.
A more comprehensive color manipulation library that not only allows color conversions but also provides features for color scale generation, color blending, and manipulation of color properties. It is more feature-rich compared to @csstools/convert-colors.
A small, fast library for color parsing and manipulation. It provides color conversion as well as utility functions for readability, darkness, and other color-related calculations. It is a good alternative with a simple API.
Convert Colors converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more.
import convert from '@csstools/convert-colors';
convert.rgb2hsl(100, 100, 100); // [ 0, 0, 100 ]
convert.rgb2hwb(100, 100, 100); // [ 0, 100, 0 ]
convert.hsl2rgb(0, 0, 100); // [ 0, 100, 0 ]
convert.hsl2hwb(0, 0, 100); // [ 0, 100, 0 ]
convert.hwb2rgb(0, 100, 0); // [ 0, 0, 100 ]
convert.hwb2hsl(0, 100, 0); // [ 0, 0, 100 ]
convert.rgb2hue(0, 0, 100); // 240
convert.rgb2contrast([100, 100, 100], [0, 0, 0]); // 21
convert.rgb2ciede2000([100, 100, 100], [0, 0, 0]); // 100
Add Convert Colors to your build tool:
npm install @csstools/convert-colors --save-dev
Conversions work by taking arguments that represents a color in one color space and returning an array of that same color in another color space.
2.0.0 (January 25, 2019)
FAQs
Convert colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
The npm package @csstools/convert-colors receives a total of 477,099 weekly downloads. As such, @csstools/convert-colors popularity was classified as popular.
We found that @csstools/convert-colors 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.