RGBA

From Sven Co-op
Revision as of 20:46, 27 March 2025 by Outerbeast (talk | contribs)
Jump to navigation Jump to search

The RGBA class is essentially a uint8 array of size 4 which is used to define colours with four components: Red, Green, Blue, and Alpha (transparency). This class is particularly useful for customizing visual elements in the game, such as HUD colors, text, or other graphical features.

Each component of the RGBA class is typically represented as an integer value ranging from 0 to 255:

  • Red (r): Controls the intensity of the red color.
  • Green (g): Controls the intensity of the green color.
  • Blue (b): Controls the intensity of the blue color.
  • Alpha (a): Determines the transparency level, where 0 is fully transparent and 255 is fully opaque.

An RGBA object can be instanced with the RGBA data type, like so:

RGBA rgbaMyColour( 255, 0, 0, 128 ); // Semi-transparent red

Each RGBA component can be accessed via the fields r, g, b and a, like so:

rgbaMyColour.r // 255
rgbaMyColour.g // 0
rgbaMyColour.b // 0
rgbaMyColour.a // 128

1 Methods

Declaration Description
void RGBA() Default constructor
void RGBA(uint8 r, uint8 g, uint8 b, uint8 a = 255) Constructor
void RGBA(const Vector& in color, uint8 a = 255) Constructor using an input vector
void RGBA(const RGBA& in other) Copy constructor
RGBA& opAssign(const RGBA& in other) Assignment operator
bool opEquals(const RGBA& in other) const Compare colors
string ToString(const bool withAlpha = true) const Returns a string representation of this RGBA

2 Properties

Declaration Description
uint8 r Red component
uint8 g Green component
uint8 b Blue component
uint8 a Alpha component

3 Preset Colours

These are all preset RGBA colors that can be used. All these constants exist in global namespace.

Constant Description
const RGBA RGBA_MEDIUM_VIOLET_RED Medium violet red
const RGBA RGBA_DEEP_PINK Deep pink
const RGBA RGBA_PALE_VIOLET_RED Pale violet red
const RGBA RGBA_HOT_PINK Hot pink
const RGBA RGBA_LIGHT_PINK Light pink
const RGBA RGBA_PINK Pink
const RGBA RGBA_DARK_RED Dark red
const RGBA RGBA_RED Red
const RGBA RGBA_FIREBRICK Firebrick
const RGBA RGBA_CRIMSON Crimson
const RGBA RGBA_INDIAN_RED Indian red
const RGBA RGBA_LIGHT_CORAL Light coral
const RGBA RGBA_SALMON Salmon
const RGBA RGBA_DARK_SALMON Dark salmon
const RGBA RGBA_LIGHT_SALMON Light salmon
const RGBA RGBA_ORANGE_RED Orange red
const RGBA RGBA_TOMATO Tomato
const RGBA RGBA_DARK_ORANGE Dark orange
const RGBA RGBA_CORAL Coral
const RGBA RGBA_ORANGE Orange
const RGBA RGBA_DARK_KHAKI Dark khaki
const RGBA RGBA_GOLD Gold
const RGBA RGBA_KHAKI Khaki
const RGBA RGBA_PEACH_PUFF Peach puff
const RGBA RGBA_YELLOW Yellow
const RGBA RGBA_PALE_GOLDENROD Pale goldenrod
const RGBA RGBA_MOCCASIN Moccasin
const RGBA RGBA_PAPAYA_WHIP Papaya whip
const RGBA RGBA_LIGHT_GOLDENROD_YELLOW Light goldenrod yellow
const RGBA RGBA_LEMON_CHIFFON Lemon chiffon
const RGBA RGBA_LIGHT_YELLOW Light yellow
const RGBA RGBA_MAROON Maroon
const RGBA RGBA_BROWN Brown
const RGBA RGBA_SADDLE_BROWN Saddle brown
const RGBA RGBA_SIENNA Sienna
const RGBA RGBA_CHOCOLATE Chocolate
const RGBA RGBA_DARK_GOLDENROD Dark goldenrod
const RGBA RGBA_PERU Peru
const RGBA RGBA_ROSY_BROWN Rosy brown
const RGBA RGBA_GOLDENROD Goldenrod
const RGBA RGBA_SANDY_BROWN Sandy brown
const RGBA RGBA_TAN Tan
const RGBA RGBA_BURLYWOOD Burlywood
const RGBA RGBA_WHEAT Wheat
const RGBA RGBA_NAVAJO_WHITE Navajo white
const RGBA RGBA_BISQUE Bisque
const RGBA RGBA_BLANCHED_ALMOND Blanched almond
const RGBA RGBA_CORNSILK Cornsilk
const RGBA RGBA_INDIGO Indigo
const RGBA RGBA_PURPLE Purple
const RGBA RGBA_DARK_MAGENTA Dark magenta
const RGBA RGBA_DARK_VIOLET Dark violet
const RGBA RGBA_DARK_SLATE_BLUE Dark slate blue
const RGBA RGBA_BLUE_VIOLET Blue violet
const RGBA RGBA_DARK_ORCHID Dark orchid
const RGBA RGBA_FUCHSIA Fuchsia
const RGBA RGBA_MAGENTA Magenta
const RGBA RGBA_SLATE_BLUE Slate blue
const RGBA RGBA_MEDIUM_SLATE_BLUE Medium slate blue
const RGBA RGBA_MEDIUM_ORCHID Medium orchid
const RGBA RGBA_MEDIUM_PURPLE Medium purple
const RGBA RGBA_ORCHID Orchid
const RGBA RGBA_VIOLET Violet
const RGBA RGBA_PLUM Plum
const RGBA RGBA_THISTLE Thistle
const RGBA RGBA_LAVENDER Lavender
const RGBA RGBA_MIDNIGHT_BLUE Midnight blue
const RGBA RGBA_NAVY Navy
const RGBA RGBA_DARK_BLUE Dark blue
const RGBA RGBA_MEDIUM_BLUE Medium blue
const RGBA RGBA_BLUE Blue
const RGBA RGBA_ROYAL_BLUE Royal blue
const RGBA RGBA_STEEL_BLUE Steel blue
const RGBA RGBA_DODGER_BLUE Dodger blue
const RGBA RGBA_DEEP_SKY_BLUE Deep sky blue
const RGBA RGBA_CORNFLOWER_BLUE Cornflower blue
const RGBA RGBA_SKY_BLUE Sky blue
const RGBA RGBA_LIGHT_SKY_BLUE Light sky blue
const RGBA RGBA_LIGHT_STEEL_BLUE Light steel blue
const RGBA RGBA_LIGHT_BLUE Light blue
const RGBA RGBA_POWDER_BLUE Powder blue
const RGBA RGBA_TEAL Teal
const RGBA RGBA_DARK_CYAN Dark cyan
const RGBA RGBA_LIGHT_SEA_GREEN Light sea green
const RGBA RGBA_CADET_BLUE Cadet blue
const RGBA RGBA_DARK_TURQUOISE Dark turquoise
const RGBA RGBA_MEDIUM_TURQUOISE Medium turquoise
const RGBA RGBA_TURQUOISE Turquoise
const RGBA RGBA_AQUA Aqua
const RGBA RGBA_CYAN Cyan
const RGBA RGBA_AQUAMARINE Aquamarine
const RGBA RGBA_PALE_TURQUOISE Pale turquoise
const RGBA RGBA_LIGHT_CYAN Light cyan
const RGBA RGBA_DARK_GREEN Dark green
const RGBA RGBA_GREEN Green
const RGBA RGBA_DARK_OLIVE_GREEN Dark olive green
const RGBA RGBA_FOREST_GREEN Forest green
const RGBA RGBA_SEA_GREEN Sea green
const RGBA RGBA_OLIVE Olive
const RGBA RGBA_OLIVE_DRAB Olive drab
const RGBA RGBA_MEDIUM_SEA_GREEN Medium sea green
const RGBA RGBA_LIME_GREEN Lime green
const RGBA RGBA_LIME Lime
const RGBA RGBA_SPRING_GREEN Spring green
const RGBA RGBA_MEDIUM_SPRING_GREEN Medium spring green
const RGBA RGBA_DARK_SEA_GREEN Dark sea green
const RGBA RGBA_MEDIUM_AQUAMARINE Medium aquamarine
const RGBA RGBA_YELLOW_GREEN Yellow green
const RGBA RGBA_LAWN_GREEN Lawn green
const RGBA RGBA_CHARTREUSE Chartreuse
const RGBA RGBA_LIGHT_GREEN Light green
const RGBA RGBA_GREEN_YELLOW Green yellow
const RGBA RGBA_PALE_GREEN Pale green
const RGBA RGBA_MISTY_ROSE Misty rose
const RGBA RGBA_ANTIQUE_WHITE Antique white
const RGBA RGBA_LINEN Linen
const RGBA RGBA_BEIGE Beige
const RGBA RGBA_WHITE_SMOKE White smoke
const RGBA RGBA_LAVENDER_BLUSH Lavender blush
const RGBA RGBA_OLD_LACE Old lace
const RGBA RGBA_ALICE_BLUE Alice blue
const RGBA RGBA_SEASHELL Seashell
const RGBA RGBA_GHOST_WHITE Ghost white
const RGBA RGBA_HONEYDEW Honeydew
const RGBA RGBA_FLORAL_WHITE Floral white
const RGBA RGBA_AZURE Azure
const RGBA RGBA_MINT_CREAM Mint cream
const RGBA RGBA_SNOW Snow
const RGBA RGBA_IVORY Ivory
const RGBA RGBA_WHITE White
const RGBA RGBA_BLACK Black
const RGBA RGBA_DARK_SLATE_GRAY Dark slate gray
const RGBA RGBA_DIM_GRAY Dim gray
const RGBA RGBA_SLATE_GRAY Slate gray
const RGBA RGBA_GRAY Gray
const RGBA RGBA_LIGHT_SLATE_GRAY Light slate gray
const RGBA RGBA_DARK_GRAY Dark gray
const RGBA RGBA_SILVER Silver
const RGBA RGBA_LIGHT_GRAY Light gray
const RGBA RGBA_GAINSBORO Gainsboro
const RGBA RGBA_MS_MONEY_GREEN Money green (MS)
const RGBA RGBA_MS_SKY_BLUE Sky blue (MS)
const RGBA RGBA_MS_CREAN Cream (MS)
const RGBA RGBA_MS_MEDIUM_GRAY Medium gray (MS)
const RGBA RGBA_SVENCOOP Sven Co-op brand color
const RGBA RGBA_SVENCOOP_HUD Sven Co-op HUD color