I want to convert "#0ff" this hexadecimal string into Color
I have searched it But I only found answers with the hexadecimal string with length 6 digits
If I do like this Color(0xFF0ff)
It displays nothing
Thanks in advance!
Web defines colours in three ways: explicit colour name, 3 hex digits, or 6 hex digits.
If you have 3 digits, you should "double" every digit (as character, not as value), so #abc is to be read as #aabbcc. Why? It is short, and it helped to select fewer colours (in the olden time we have 8 or 16bit colours), and screens may not be so accurate.
Do your #0ff
should be read as #00ffff
.
Note: These 3 digit colours are now considered obsolote, see https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#simple-colour, but still used on many places (e.g. #fff for white).