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.
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.
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
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 ?
https://drive.google.com/file/d/1-fJc6lMYnOXw76BKQ-7xRbTX-Fr8iKSf/view?usp=sharing
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 !
Eugene Morozov
> You can't get opacity in HEX, can you?
I'm kinda lost on this one, wdym by data loss?
I'm using intellij with `react-native` (typescript), I needed to use the `material-foundation/material-color-utilities` package and whoever designed that lib decided that their HEX color should be AARRGGBB (and some variants), its really nice that intellij shows the color as a gutter icon, but when I use the picker it changes the string to `rgba(r,g,b,a)`. This will break my code which only supports hex, I'm also trying to make the code play nice with intellij so I'm converting whatever I can to the normal react-native hex (RRGGBBAA - which intellij supports) and isolating usages to the normal hex…
But having an option to force intellij to only use a specific pattern for the output color string would be awesome
(I also would prefer to use uint `0x00000000` colors, but intellij doesn't recognize them as colors in typescript, but that make sense since colors are supported by the css plugin)