RGB
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

RGB

  • Dark
    Light
  • PDF

Generate a color based on the given values for the red, green, blue and alpha components. Returns a text representing the color if valid, or null if invalid.

Function signature

RGB(red: Number, green: Number, blue: Number, alpha: Number = 1) => String
Parameter Description
Red Red component
Green Green component
Blue Red component
Alpha Alpha component

Examples

Formula Return value
RGB(125, 125, 125) rgb(125,125,125)
RGB(125, 125, 125, 0.5) rgba(125,125,125,0.5)
RGB(333, -333, 0, -1) rgba(255,0,0,0)

Was this article helpful?

What's Next