Skip to main content

RGB/RGBA

RGBA​

interface RGBA {
// "Red"
readonly r: number
// "Green"
readonly g: number
// "Blue"
readonly b: number
// "Alpha" or "opacity"
readonly a: number
}

Represents a full Figma color value. These values are from 0 to 1. For example black is {r: 0, g: 0, b: 0, a: 1} and white is {r: 1, g: 1, b: 1, a: 1}.

interface RGB {
readonly r: number
readonly g: number
readonly b: number
}

Represents a color just like RGBA but without an alpha value. This is only used for SolidPaint. Colors normally have an alpha value but all paints have an opacity value so alpha was redundant for SolidPaint.

Figma supports color management. All colors are specified in the same color space which will be the color profile of the document, documentColorProfile.

Color values in paints, gradient stops, and effects can include a sourceColor property that preserves the original color space and components used to author the color. The r, g, and b fields remain the RGB projection for the current document color profile. Supported source color spaces are SRGB, DISPLAY_P3, HSL, HSB, OKLAB, and OKLCH.