Farben

Vordefinierte Farben, RGB/RGBA-Konstruktion und Alpha-Varianten.

Eigene Farben

// RGB (255-basiert, 0–255 pro Kanal)
uint orange  = Color.RGB(255, 128, 0);

// RGBA (mit Alpha-Kanal, 0=transparent, 255=deckend)
uint semiRed = Color.RGBA(255, 0, 0, 128);

// Alpha-Variante einer bestehenden Farbe
uint halfBlack = Color.Black.WithAlpha(128);
uint semiCyan  = Color.Cyan.WithAlpha(200);

Vordefinierte Farben

Color.Black #000000
Color.White #ffffff
Color.Red #ff0000
Color.Green #00c800
Color.Blue #0000ff
Color.Yellow #ffff00
Color.Cyan #00ffff
Color.Magenta #ff00ff
Color.Gray #808080
Color.DarkGray #404040
Color.LightGray #c0c0c0
Color.Orange #ffa500
Color.Pink #ff69b4
Color.Purple #800080
Color.Brown #8b4513
Color.Teal #008080
Color.Lime #00ff00
Color.Navy #000080
Color.Silver #c0c0c0
Color.Maroon #800000
Color.Olive #808000

Verwendung

public override void OnFrame()
{
    Graphics.FillScreen(Color.Black);

    // Vordefinierte Farben
    Graphics.FillRect(10, 10, 100, 50, Color.Red);
    Graphics.DrawRect(10, 10, 100, 50, Color.White);

    // RGB-Farbe
    uint myBlue = Color.RGB(30, 80, 200);
    Graphics.FillCircle(200, 200, 40, myBlue);

    // Alpha-Blending
    uint semiWhite = Color.White.WithAlpha(128);
    Graphics.FillRectAlpha(0, 0, 1280, 720, Color.Black, 100);

    // Farb-Interpolation (manuell)
    int t = _frame % 255;
    uint fade = Color.RGB(t, 255 - t, 128);
    Graphics.FillRect(300, 300, 100, 100, fade);
}

Technisches Format

RGBA8888 (Little-Endian)

Intern werden Farben als uint (32 Bit) gespeichert:

A[31:24] | B[23:16] | G[15:8] | R[7:0]

Entspricht dem RGBA8888-Format des Nintendo Switch Framebuffers.