40[[nodiscard]]
constexpr Color MakeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) {
41 return Color{r, g, b, a};
57 auto const r =
static_cast<uint8_t
>(rgba >> 24);
58 auto const g =
static_cast<uint8_t
>(rgba >> 16);
59 auto const b =
static_cast<uint8_t
>(rgba >> 8);
60 auto const a =
static_cast<uint8_t
>(rgba);
61 return Color{r, g, b, a};
74 return Float3{color[0] / 255.0f, color[1] / 255.0f, color[2] / 255.0f};
87 return Float4{color[0] / 255.0f, color[1] / 255.0f, color[2] / 255.0f, color[3] / 255.0f};
Predefined color constants for common use cases.
static constexpr Color kCyan
Cyan color (green + blue).
static constexpr Color kMaroon
Dark red color.
static constexpr Color kTeal
Dark cyan color.
static constexpr Color kGreen
Pure green color.
static constexpr Color kGray
Medium gray color (US spelling).
static constexpr Color kOrange
Orange color.
static constexpr Color kPurple
Dark magenta color.
static constexpr Color kYellow
Yellow color (red + green).
static constexpr Color kNavy
Dark blue color.
static constexpr Color kGrey
Medium gray color (UK spelling).
static constexpr Color kWhite
Pure white color.
static constexpr Color kBlack
Pure black color.
static constexpr Color kRed
Pure red color.
static constexpr Color kSilver
Light gray color.
static constexpr Color kBlue
Pure blue color.
static constexpr Color kOlive
Dark yellow-green color.
static constexpr Color kMagenta
Magenta color (red + blue).
NdArray< uint8_t, 4 > Color
RGBA color representation using 4 bytes (0-255 per channel) in RGBA order.
NdArray< float, 4 > Float4
constexpr Color MakeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Creates a Color from 4 unsigned bytes in RGBA order.
constexpr Float4 ToFloat4(Color const &color)
Converts a Color to a normalized Float4 vector (RGBA).
constexpr Float3 ToFloat3(Color const &color)
Converts a Color to a normalized Float3 vector (RGB only).
NdArray< float, 3 > Float3