Colors
Colors
Feiliang Zhou

Colors

#webdev#CSS#beginners#programming

RGB Model

  • Every color can be represented by a combination of RED, GREEN and BLUE.
  • Each of the 3 base colors can take a value between 0 and 255, which leads to 16.8 million different colors.

Defining colors in CSS

  1. RGB/RGBA Notation
    • Regular RGB Model rgb(0, 255, 255) rgb(244, 179, 63)
    • RGB with transparency("alpha") rgba(0, 255, 255, 0.3) rgba(244, 179, 63, 0.7)
  2. Hexadecimal Notation
  • instead of using a scale from 0 to 255, we go from 0 to ff (255 in hexadecimal numbers) #00ffff
  • shorthand, when all colors are identical pairs #0ff

SHADES of GREY

  • When colors in all 3 channels are the same, we get a grey color
  • There are 256 pure greys to choose from
  • two examples of them are rgb(69, 69, 69), #444444, #444 rgb(183, 183, 183), #b7b7b7