Color Struct
Represents an RGBA color with 8-bit channels (0-255).
public readonly struct Color : System.IEquatable<Brine2D.Core.Color>
Implements System.IEquatable<Color>
This is a cross-platform replacement for System.Drawing.Color,
designed specifically for game development and graphics rendering.
All color operations are value-based (immutable struct).
| Properties |
|
| A |
Alpha component (0-255). 255 = fully opaque, 0 = fully transparent. |
| B |
Blue component (0-255). |
| Black |
Black color (0, 0, 0). |
| Blue |
Blue color (0, 0, 255). |
| Cyan |
Cyan color (0, 255, 255). |
| DarkGray |
Dark gray color (64, 64, 64). |
| DarkSlateBlue |
Dark slate blue color (72, 61, 139). |
| G |
Green component (0-255). |
| Gray |
Gray color (128, 128, 128). |
| Green |
Green color (0, 255, 0). |
| LightGray |
Light gray color (192, 192, 192). |
| Lime |
Lime color (0, 255, 0). |
| Magenta |
Magenta color (255, 0, 255). |
| Orange |
Orange color (255, 165, 0). |
| Purple |
Purple color (128, 0, 128). |
| R |
Red component (0-255). |
| Red |
Red color (255, 0, 0). |
| Transparent |
Transparent color (0, 0, 0, 0). |
| White |
White color (255, 255, 255). |
| Yellow |
Yellow color (255, 255, 0). |
| Methods |
|
| FromVector3(Vector3) |
Creates a color from a Vector3 with normalized RGB values (0.0-1.0). Alpha defaults to 1.0 (fully opaque). |
| FromVector4(Vector4) |
Creates a color from a Vector4 with normalized values (0.0-1.0). |
| Lerp(Color, Color, float) |
Linearly interpolates between two colors. |
| ToRgba() |
Packs the color into a 32-bit unsigned integer (0xRRGGBBAA format). |
| ToVector3() |
Converts to a Vector3 with normalized RGB values (0.0-1.0), ignoring alpha. |
| ToVector4() |
Converts to a Vector4 with normalized values (0.0-1.0). Useful for shader uniforms and GPU rendering. |
| WithAlpha(byte) |
Returns a new color with the specified alpha value. |
| WithAlpha(float) |
Returns a new color with the specified alpha value. |