Convert CSS Color Value to rgb()

Hello everyone, I am using PhpStorm 6.0 and i got a new weak warrning ("The inspection detects CSS colors which defined as HEX, and provides a quickfix action to convert such values to a CSS rgb() function call."), I never saw this weak warnings before, If anyone know what how to fix this, Thank you all and have a nice day.

10 comments

Settings | Inspections | CSS -- you should easily find that particular inspection by its name.

Another (quicker) way to get there (to a specific inspection .. or disable it straight there without actually going into settings) -- Alt+Enter on error (or click on light bulb icon), use Right Arrow key on correct menu entry and choose appropriate entry from submenu.

0

Thank you for your answer, I did disable this inspection but if you can please help me understand this inspection so i have to option to fix the problem without disable the inspection, thanks again and have a nice day.

0

This inspection detects how you define your color in CSS. This particular one does not like color defined in HEX format, e.g #FF0000 or #F00 -- it want's it to be rgb(255, 0, 0) (which is exactly the same color -- RED: http://www.w3.org/wiki/CSS/Properties/color/RGB )

0

Thank again for the replay, I did try every format: rgb,rgba,#rrggbb,#rgb also used rgb with percentage, The warning is there i don't know why, for example there is piece of my code:

border-top: 1px solid #fff;

border-top: 1px solid #ffffff;

border-top: 1px solid #000;

border-top: 1px solid #000000;

border-top: 1px solid rgb(100%,100%,100%);

border-top: 1px solid rgb(0,0,0);

border-top: 1px solid rgba(0,0,0);

border-top: 1px solid rgba(10%, 50%, 30%, 0.5);

All will result the same warning nothing is changed, If you can try and give me your own example for the good format i will be very thankful.

0

Sorry -- I cannot figure out what kind of problem you are facing -- it looks fine here.

Please provide screenshot(s) with the errors.

0

Hey i did get a print screen of the warning, This is the link: http://s4.postimg.org/yphfyb8z1/cap.jpg, Also about the problem, everytime i define a color, It can be any color/background color/border color/etc I get this warning, And thanks for the replay.

0

So... what is the problem? The inspection is still on.

There are 2 inspections -- one about HEX to RGB and another about RGB to HEX. Maybe you have just disabled wrong one?

screen01.png

0

My problem is not that when i disable the inspection the warning is there, The warning is gone after i disable the HEX to RGB inspection,
What i am trying to do is to solve this problem for example i got the inspection about HEX to RGB so i will format the colors to RGB but has you can see here:

border-top: 1px solid #fff;

border-top: 1px solid #ffffff;

border-top: 1px solid #000;

border-top: 1px solid #000000;

border-top: 1px solid rgb(100%,100%,100%);

border-top: 1px solid rgb(0,0,0);

border-top: 1px solid rgba(0,0,0);

border-top: 1px solid rgba(10%, 50%, 30%, 0.5);


I have tryed every format i know and the inspection is there, I don't want to disable the inspection, I wan't to solve the problem the inspection is warning about, Thank you and have a nice day.

0

You have this line:

border-top: 1px solid #fff;


The "HEX to RGB Inspection" says "I do not like #fff -- it has to be converted to rgb() syntax"

So -- go ahead and convert it if you want.

border-top: 1px solid rgb(255,255,255);


This inspection is optional, there is NOTHING wrong with any of the color representation formats. It is there just to help you to use SINGLE style (be it HEX or RGB -- hence 2 OPPOSITE inspections). Just find that inspection in "Settings | Inspections" and read the description.

0

Thank you now i got that and understand, Also i get that phpstorm want me to use a single format (they want me follow a pattern of coding), Thanks again and have a nice day.

0

Please sign in to leave a comment.