https://github.com/avigoldman/postcss-hex-format
PostCSS plugin to format hexadecimal colors
https://github.com/avigoldman/postcss-hex-format
color css format hex hexadecimal postcss
Last synced: 3 months ago
JSON representation
PostCSS plugin to format hexadecimal colors
- Host: GitHub
- URL: https://github.com/avigoldman/postcss-hex-format
- Owner: avigoldman
- Created: 2017-09-17T01:17:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-18T17:58:05.000Z (almost 9 years ago)
- Last Synced: 2025-10-20T12:16:57.057Z (8 months ago)
- Topics: color, css, format, hex, hexadecimal, postcss
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# postcss-hex-format
This plugin will format hexadecimal colors.
### Installation
```sh
npm install postcss-hex-format --save
```
### Usage
```js
const config = {
length: "long",
case: "upper"
};
postcss([ require('postcss-hex-format')(config) ])
// do your processing here 🎉
```
Or use it in some other [PostCSS way](https://github.com/postcss/postcss#usage).
### Options
#### `length`
**Possible values:** `short` or `long`.
**Default:** `long`
Use this option to define whether hex colors should be lengthened or shortened if possible.
#### `case`
**Possible values:** `upper` or `lower`.
**Default:** `upper`
Use this option to define whether hex colors should be uppercase or lowercase.
### Example
If you configure it to use the long form and uppercase as shown in the usage and process the following:
```css
a {
color: #abc;
}
```
You will get this result:
```css
a {
color: #AABBCC;
}
```
### Related
* [colornames to hex](https://github.com/avigoldman/postcss-colornames-to-hex)
* [rgb() and rgba() colors to hex](https://www.npmjs.com/package/postcss-rgba-hex)