
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
convert-to-oklch
Advanced tools
CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files.
CLI tool that converts rgb()
, rgba()
, hex, hsl()
and hsla()
colors to oklch() in specified CSS files.
npx convert-to-oklch ./src/**/*.css
.header {
- background: rgb(102, 173, 221);
+ background: oklch(72% 0.1 239.8);
}
oklch()
provides better readability since it uses lightness
, chroma
, and hue
components (closer to how people think and work with colors) instead of “magic tokens” like #4287f5
. In contrast with hsl()
, OKLCH has no issues with contrast and a11y.
Don’t forget to add postcss-preset-env
to PostCSS to have oklch()
polyfill.
After conversion, the value of each color component is rounded:
- oklch(60.66305848755579% 0.11082513148527705 250.4762110872339 / 0.4)
+ oklch(60.7% 0.11 250 / 0.4)
// l - up to 1 digit after the decimal point
// c - up to 3 digits after the decimal point
// h - up to 1 digit after the decimal point
You can also specify precision of color conversion by using -p
or --precision
option. Available values are 1-21 inclusive.
Conversion is done with colorjs package by Lea Verou.
npx convert-to-oklch ./src/*.css -p 2
Colors that contain custom properties inside are ignored:
a {
color: rgb(102, 173, 221, var(--opacity));
}
In this case the color will not be converted.
Read more about color spaces in css:
FAQs
CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files.
The npm package convert-to-oklch receives a total of 6 weekly downloads. As such, convert-to-oklch popularity was classified as not popular.
We found that convert-to-oklch 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 Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.