How to default CSS color to HEX NOT RGB.

Answered

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 ! 

11 comments

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?

0

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. 

0

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.

http://recordit.co/nwnVFLEXa9

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.

0

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: 

https://drive.google.com/file/d/1_FN8yXkE5C7tfFfIkCsXp498WAqfTohc/view?usp=sharing 

 

 

0

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.

0

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

https://drive.google.com/file/d/1-fJc6lMYnOXw76BKQ-7xRbTX-Fr8iKSf/view?usp=sharing 

 

Thanks !

0

Maybe you do not have the appropriate intention enabled?

Settings/Preferences | Editor | Intentions | CSS ?

0

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

 

0

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.

 

0

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.

1

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 ! 

0

Please sign in to leave a comment.