Account
Categories

RGB Colors and RGBA Colors


1. RGB Colors:

You can use RGB values as the value of the color property in the style attribute ().

Example:

<p style="color:rgb(255,0,0);">
This example uses the RGB color value in a line.
</p>

Output:

This example uses the RGB color value in a line.


List of Common RGB Color Values as follows:

  • rgb(255,0,0) → Red
  • rgb(0,255,0) → Green
  • rgb(0,0,255) → Blue
  • rgb(255,255,0) → Yellow
  • rgb(0,0,0) → Black
  • rgb(255,255,255) → White

2. RGBA Colors:

You can use RGBA values as the value of the color property in the style attribute ().

Example:

<p style="color:rgba(255,0,0,0.5);">
The RGBA color value is used in this text.
</p>

Output:

The RGBA color value is used in this text.


List of Common RGBA Color Values as follows:

  • rgba(255,0,0,0.5) → Red
  • rgba(0,255,0,0.5) → Green
  • rgba(0,0,255,0.5) → Blue
  • rgba(255,255,0,0.5) → Yellow
  • rgba(0,0,0,0.5) → Black
  • rgba(255,255,255,0.5) → White