How to default CSS color to HEX NOT RGB.


I have hunted everywhere. I can't see how to get Storm to default my css colours to Hex and NOT RGB. Where is it ? 

thanks ! 


Please clarify the exact use case.

Do you write a CSS file manually, and then choose completion (or the picket) to pick a color, and it pastes rgb(0, 0, 0) instead of #000000?


thanks for coming back. yes, as you said, I write CSS manually and when I select a colour it pastes rgb(0,0,0) instead of #00000. I then have to manually go back into the colour picker and manually copy and paste the hex code into my file. 


I can't find any way to configure this behavior, neither in docs, nor on the tracker, but for me, it pastes the HEX color no matter what I do.

I then have to manually go back into the colour picker and manually copy and paste the hex code into my file.

No need to do that, there's an intention that would do that for you.

What PhpStorm version are you running, and maybe you can provide a code sample? Not sure why we can get different results while performing the same actions.


Thanks for your help. I am using the most up to date 2018.3.3 PHP Storm. However, I run it on Linux (Mint, which is essentially Ubuntu). Looking at your Gif I can not relate to this feature. Here is a gif of what I get: 




I definitely should've mentioned that way you can invoke this menu - it's the intention/quick-fix menu, you can call it by placing the caret into a symbol and pressing Alt+Enter.


Brilliant - however one problem, when I follow your instructions, I do not get "convert to Hex" . Any ideas how to modify this ? 


Thanks !


Maybe you do not have the appropriate intention enabled?

Settings/Preferences | Editor | Intentions | CSS ?


I have that set. "Convert to Hex" is checked. 



Ok - the mystery grows longer, although with some success: I have discovered that in the case of "border: lightblue" I can convert to HEX using intentions. However, in the case of "background-color: rgba()"   HEX is NOT offered as one of the available options. Only HSLA AND HWB.



You can't get opacity in HEX, can you?

I mean, it's a data loss, that's probably why we don't do that.


Ok - the mystery is resolved. Many Thanks ! When I take the opacity out of the RGB, I can convert to HEX. I learned all about intentions today. Thank you ! 


Please sign in to leave a comment.