Construct a color from red, green, blue, and alpha channels.
Color
RGBA colors.
Channels are 8-bit sRGB values. Alpha is 0 for transparent and 255 for
fully opaque. A color is a plain value: build one, keep it in the model, and
pass it to any drawing call.
The named constants cover the common cases, from_hex_rgb reads the form a
designer usually gives you, and with_alpha makes any of them translucent.
accent = Color.from_hex_rgb(0x2f80ed)
glow = Color.with_alpha(accent, 100)
Construct an opaque color from red, green, and blue channels.
with_alpha : Rgba, U8 -> Rgba
Return a copy with a new alpha channel.
from_hex_rgb : U32 -> Rgba
Decode 0xRRGGBB into an opaque color.
from_hex_rgba : U32 -> Rgba
Decode 0xRRGGBBAA into a color.
transparent : Rgba
Fully transparent black.
black : Rgba
Black.
blue : Rgba
Raylib's standard blue.
dark_gray : Rgba
Raylib's standard dark gray.
gray : Rgba
Raylib's standard gray.
green : Rgba
Raylib's standard green.
light_gray : Rgba
Raylib's standard light gray.
orange : Rgba
Raylib's standard orange.
pink : Rgba
Raylib's standard pink.
purple : Rgba
Raylib's standard purple.
ray_white : Rgba
Raylib's warm off-white background color.
red : Rgba
Raylib's standard red.
white : Rgba
White.
yellow : Rgba
Raylib's standard yellow.
Rgba
:= {
r : U8,
g : U8,
b : U8,
a : U8,
}
An 8-bit sRGB color with alpha.
encoder_for : encoding -> (Rgba, state -> Try(state, err))
where [
encoding.encode_color : Rgba, state -> Try(state, err),
]
Encode this color as one semantic leaf for formats that support colors.
Shader uniform records use this to upload one normalized vec4 rather
than traversing the four byte channels as separate fields.
is_eq : _
Compare all four color channels for equality.