
Security News
Meet the Socket Team at RSAC and BSidesSF 2025
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
colornorm
PostCSS plugin for normalizing colors
Convert different syntaxes to a single one.
Useful for de-duplicating colors, and standardizing a stylesheet on one color syntax.
You may assume that the same input color will map the same output color, regardless of input syntax.
Invalid color syntax returns null. Global values ("inherit", "initial", "unset") also return null.
const colornorm = require('colornorm')
// Any crazy valid CSS color you can think of
const inputs = [
'red',
'RED',
'#f00',
'#ff0000',
'#ff0000ff',
'rgb(255,0,0)',
'rgb(255 0 0)',
'rgba(255, 0, 0, 1)',
'rgb(255 0 0 / 1)',
'hsl(0, 100%, 50%)',
'hsla(0, 100%, 50%, 1)'
// hwb, cmyk, lab, lch inputs also supported
]
const outputs = inputs.map((input) => colornorm(input))
// all are 'hsl(0 100% 50%)'
// output styles: 'hsl' (default as most human friendly widely adopted format), 'hwb', 'lab', 'lch', 'cmyk', 'rgb', 'hex'
const outputs = inputs.map((input) => colornorm(input, 'hex'))
// all are '#f00'
npm install colornorm --save
# yarn add colornorm
Alternatively, there are also client web builds available:
<!-- Dependencies -->
<!-- window.ColorNorm -->
<script src="https://unpkg.com/colornorm/dist/colornorm.umd.js"></script>
MIT
FAQs
Normalize CSS colors in a spec compliant way
The npm package colornorm receives a total of 31 weekly downloads. As such, colornorm popularity was classified as not popular.
We found that colornorm 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
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.