Git Product home page Git Product logo

postcss-rgb-plz's Introduction

postcss-rgb-plz npm version

PostCSS plugin to convert hex colors to rgb.

.foo {
  color: #333;
  box-shadow: 2px 2px 4px #f1f1f1;
}
.foo {
  color: rgb( 51, 51, 51 );
  box-shadow: 2px 2px 4px rgb( 241, 241, 241 );
}

Install

npm i --save-dev postcss-rgb-plz

Usage

postcss([ require('postcss-rgb-plz') ])

See PostCSS docs for examples for your environment.

Reasoning

Part of the CSS styleguide at my work is to always use rgb values for color, and sometimes I like to use hexes/my preprocessor will convert to hexes. This solves that issue.

postcss-rgb-plz's People

Contributors

himynameisdave avatar

Stargazers

ʟᴊᴜɴɢᴍ•ʀᴋ avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

postcss-rgb-plz's Issues

Doesn't account for multiple hexes in a given decl

Found an edge case where this won't actually convert the value:

box-shadow: 0 0 10px #ffffff, 0 2px 3px #333333;

...will convert to...

box-shadow: 0 0 10px #ffffff, 0 2px 3px rgb( 51, 51, 51 );

...and that initial #ffffff won't get converted.

Hash symbols in filenames getting caught

Sometimes if there is a hash symbol in a filename, as is sometimes the case for cacheing or more common as an added part of the url for .svg fonts, it is getting picked up and then breaks everything.

Example:
screen shot 2015-09-09 at 3 07 48 pm

FIX IT FIX IT NAO

Option for spaces

Add in a spaces config variable in case people want the output to look like this:

color: rgb( 255, 255, 255 );

instead of this which is happening by defualt:

color: rgb(255,255,255);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.