Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-color-function

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-color-function

A parser and converter for Tab Atkins's proposed color function in CSS.

  • 1.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
294K
decreased by-0.72%
Maintainers
4
Weekly downloads
 
Created

What is css-color-function?

The css-color-function npm package allows you to perform color manipulations using CSS-like syntax. It is useful for dynamically adjusting colors in your stylesheets, such as lightening, darkening, saturating, or desaturating colors.

What are css-color-function's main functionalities?

Lighten a color

This feature allows you to lighten a given color by a specified percentage. In this example, the color red is lightened by 10%.

const colorFunction = require('css-color-function');
const color = 'color(red lightness(+ 10%))';
const result = colorFunction.convert(color);
console.log(result); // Outputs: #ff3333

Darken a color

This feature allows you to darken a given color by a specified percentage. In this example, the color blue is darkened by 20%.

const colorFunction = require('css-color-function');
const color = 'color(blue lightness(- 20%))';
const result = colorFunction.convert(color);
console.log(result); // Outputs: #0000cc

Saturate a color

This feature allows you to increase the saturation of a given color by a specified percentage. In this example, the color green is saturated by 30%.

const colorFunction = require('css-color-function');
const color = 'color(green saturation(+ 30%))';
const result = colorFunction.convert(color);
console.log(result); // Outputs: #00ff00

Desaturate a color

This feature allows you to decrease the saturation of a given color by a specified percentage. In this example, the color purple is desaturated by 40%.

const colorFunction = require('css-color-function');
const color = 'color(purple saturation(- 40%))';
const result = colorFunction.convert(color);
console.log(result); // Outputs: #993399

Other packages similar to css-color-function

Keywords

FAQs

Package last updated on 07 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc