Css Colors Hex Math
For example ff0000 is displayed as red because red is set to its highest value ff and the others are set to the lowest value 00.
Css colors hex math. Var z1 z substring 0 y. In css a color can be specified using a hexadecimal value in the form. An example of this would be ffffff white or 000000 black. The format of the css hex code is rrggbb.
Where rr red gg green and bb blue are hexadecimal values between 00 and ff same as decimal 0 255. The letters refer to red rr green gg and blue bb so you can think of the 6 character value as being three two digit hexadecimal numbers. In css you need to use the pound hash symbol before your hex code for it to be valid. The css 3 digit hex color notation is shorthand for the 6 digit hex notation.
One for each of the three colors. This results in a three digit hex number instead of six. Three digit shorthand is where you combine the duplicate digits from each color component into one. If you are somewhat familiar with css you know that colors are either specified in a rgb or hex code format.
This way if the length of the hex number is too short the appropriate number of zeros are added to the beginning and you don t get any illegal values for color. Var x math round 0xffffff math random tostring 16.