Loading Please Wait...

Logo Lynxsia IT Solutions
CSS Colors

In CSS, we can define colors in the following ways:

  • 1: Color Names
  • 2: RGB and RGBA Colors
  • 3: HEX Colors
  • 4: HSL and HSLA Colors
Color Names

You can use 140 standard colors name to define a color. For example red, black, blue, aqua, azure, etc. Use lowercase for color name as per standard. Otherwise color name is not case sensitive, Red, RED, red all are same.

Black
White
Red
Blue
Green
Aqua
AliceBlue
Azure
BlueViolet
Brown
Crimson
DeepPink
RGB And RGBA Colors

RGB colors represent Red, Blue, and Green colors whereas RGBA colors represent RGB with Alpha (Opacity).

Use rgb(red, green, blue) or rgba(red, green, blue, alpha) syntax to define RGB and RGBA colors respectively.

Here red, green, and blue represent the intensity of the color ranging from 0 to 255.

Alpha ranges from 0.0 (fully transparent) to 1.0 (Not transparent at all).

rgb(0, 0, 0)
rgb(255, 255, 255)
rgb(255, 0, 0)
rgb(0, 255, 0)
rgb(0, 0, 255)
rgb(143, 75, 213)
rgba(0, 255, 0, 0.5)
rgba(143, 75, 213, 0.75)
Try Mixing These RGBA Values
rgba(0, 0, 0, 1)
Hex Colors

Hexadecimal colors are represented by #rrggbb, where rr(Red), gg(Green), and bb(Blue).

The value for rr, gg, and bb ranges from 00 to ff just like hexadecimal numbers.

You can also define alpha (opacity) just like RGBA colors for hex colors. Use #rrggbbaa to define hex colors with alpha where aa represents alpha with range from 00 to ff.

#000000
#ffffff
#00ff00
#0000ff
#2a35d4
#4ada2e
#f2aa4e
#0000ff9e
Try Mixing These HEX Values
#000000
HSL And HSLA Colors

HSL colors represent Hue, Saturation, and Lightness whereas HSLA represent Hue, Saturation, Lightness, and Alpha (opacity)

Use hsl(hue, saturation, lightness) or hsla(hue, saturation, lightness, alpha) syntax to define HSL and HSLA colors respectively.

Hue is the degree of the color wheel ranges from 0 to 360. Where 0 is red, 120 is green, and 240 is blue.

Saturation is the percentage value (normally shade of gray) where 0% means shades of gray and 100% means full color.

Lightness is the percentage value of light given to color where 0% means black and 100% means white.

Alpha ranges from 0.0 (fully transparent) to 1.0 (Not transparent at all).

hsl(0, 0%, 0%)
hsl(0, 100%, 100%)
hsl(0, 100%, 50%)
hsl(120, 100%, 50%)
hsl(240, 100%, 50%)
hsl(154, 22%, 64%)
hsla(240, 100%, 50%, 0.3)
hsla(154, 22%, 64%, 0.75)
Try Mixing These HSLA Values
hsla(0, 0%, 0%, 1)

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved