Socket
Book a DemoInstallSign in
Socket

postcss-colour-functions

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-colour-functions

PostCSS plugin with some useful, Sass-like colour functions

1.5.2
latest
npmnpm
Version published
Weekly downloads
23
21.05%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-colour-functions

Packagist downloads

PostCSS plugin for Sass-like colour functions.

..

Install

npm install postcss-colour-functions --save

Then just require it in whatever task runner you prefer like so:

var colourFunctions = require('postcss-colour-functions');

..

Colour Functions

The plugin expects colours to be entered in either RGB/A or hexidecimal format. No HSL is usable as yet. It does also accept some basic CSS colour codes, but the list is by no means exhaustive.

darken

Darkens a colour by a specific amount, specified either as a decimal or percentage:

/* so this */
.element{
    color: darken(#00b, 20%); // you could also use '0.2' instead of '20%'
}
    
/* becomes this */
.element{
    color: rgb(0,0,150);
}

lighten

The same as darken, except it tints the colour as opposed to shading it:

/* so this */
.element{
    color: lighten(#00b, 20%); // you could also use '0.2' instead of '20%'
}
    
/* becomes this */
.element{
    color: rgb(51,51,201);
}

opacity

Specify an opacity for a given colour. This returns an rgba value:

/* so this */
.element{
    color: opacity(#00b, 20%); // you could also use '0.2' instead of '20%'
}

/* becomes this */
.element{
    color: rgba(0,0,187,0.2);
}

..

License

MIT

If you have any improvements I'm super keen to pull them in.

Keywords

postcss

FAQs

Package last updated on 17 Jan 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.