Jump to content
You must now use your email address to sign in [click for more info] ×

RC2 - Copied hex colour values aren't valid CSS


Recommended Posts

When using the Colour panel's option to "Copy Colour to Clipboard as Hex," the resulting value may have five digits if the red value is less than 16. For instance, RGB(15,12,9) copies to the clipboard as "#F0C09". It should be "#0F0C09".

Link to comment
Share on other sites

When using the Colour panel's option to "Copy Colour to Clipboard as Hex," the resulting value may have five digits if the red value is less than 16. For instance, RGB(15,12,9) copies to the clipboard as "#F0C09". It should be "#0F0C09".

 

It's even worse for a colour such as RGB(0,12,9), which copies to the clipboard as "#C09". For CSS purposes, this is shorthand for "#CC0099" (which has no green, and a large red component instead of none at all).

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

  • Staff

It's even worse for a colour such as RGB(0,12,9), which copies to the clipboard as "#C09". For CSS purposes, this is shorthand for "#CC0099" (which has no green, and a large red component instead of none at all).

That value is actually correct/valid in HTML/CSS. Hex colours formatted like that is valid in websites - however if the 2 digits of each component is different then you will have to use a 6digit value. That said I think IE had problems with them, not sure if it still does mind!

Link to comment
Share on other sites

    That value is actually correct/valid in HTML/CSS.

 

Yes, that's what I meant by my "this is shorthand" comment. The colour specified by "#000C09" is almost black, since it comprises no red and only a small amount of green and blue; the colour specified by "#C09" is heliotrope, with lots of red, no green, and a healthy dollop of blue.

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

  • Staff

Yes, that's what I meant by my "this is shorthand" comment. The colour specified by "#000C09" is almost black, since it comprises no red and only a small amount of green and blue; the colour specified by "#C09" is heliotrope, with lots of red, no green, and a healthy dollop of blue.

Ahh yes of course! I get you now :)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.