What type of colour code is this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

29th Jul 2020, 2:59 PM
Clueless Coder
Clueless Coder - avatar
7 Answers
+ 6
Calviղ Thanks.
29th Jul 2020, 3:10 PM
Clueless Coder
Clueless Coder - avatar
+ 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!
29th Jul 2020, 4:42 PM
Clueless Coder
Clueless Coder - avatar
+ 5
Hex code in C or Java language
29th Jul 2020, 3:09 PM
Calviղ
Calviղ - avatar
+ 4
Calviղ I've done some looking about, there appears to be little converters. Do you know any Java hex converters?
29th Jul 2020, 3:12 PM
Clueless Coder
Clueless Coder - avatar
+ 3
Kode Krasher Thanks, that helps a ton. Weird how a Javascript library only supports C color syntax
29th Jul 2020, 3:41 PM
Clueless Coder
Clueless Coder - avatar
+ 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.
30th Jul 2020, 12:49 PM
Mark McClan
Mark McClan - avatar
+ 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
31st Jul 2020, 12:42 PM
Hanuma Ukkadapu
Hanuma Ukkadapu - avatar