+ 6
What type of colour code is this?
In my Javascript library, it won't let me use hex-codes, rgb or colour names. I have to use 0xaa0000. This comes out as red (got the code from Reddit). Google says this is a hex code, I thought hex codes start with #. What is this? What format? Is there a color converter that supports this format?
7 Antworten
+ 6
Calviղ Thanks.
+ 6
MR CRIS Wow, you went lower! Congrats! First you steal codes and pass it off as your own, now you advertise on my question!
+ 5
Hex code in C or Java language
+ 4
Calviղ I've done some looking about, there appears to be little converters. Do you know any Java hex converters?
+ 3
Kode Krasher Thanks, that helps a ton. Weird how a Javascript library only supports C color syntax
+ 3
I wish I could remember who it was, but someone here on SoloLearn has put a code displayer. Actually I think there are a couple.
Enter the code and it displays the colour.
Now I remember there was another, it had red, green and blue sliders to perform the same thing.
Search the code projects, your bound to find one.
+ 3
Clueless Coder
Every number has a base and the prefix has the info about it so the computer can understand and interpret the number correctly.
See this link:https://stackoverflow.com/questions/2670639/why-are-hexadecimal-numbers-prefixed-with-0x
Prefix - Base - Name
0b - 2 - Binary
0o/0 - 8 - Octal
0x - 16 - Hexadecimal
Usually decimal numbers don't need to have a prefix.
Ex.
-----
let d = 8; //Treats as a decimal number
let x = f; //Throws a ReferenceError in js as it treats f as a variable identifier
let xe = 0xf;//treats it as a number and its value is 15
----
See this code :
https://code.sololearn.com/WZIV90PpPOBK/?ref=app