Skip to content
FutureBlitz

    Install

    Import std.math.color

    Color32

    std.math.color

    struct

    Public Struct Color32 Implements Hashable, Printable

    Four bytes: sRGB red, green, and blue, and alpha, from 0 to 255.

    Examples

    Local orange = Color32.Hex("#ffa500")
    Expect(orange.r == 255 && orange.g == 165 && orange.b == 0 && orange.a == 255)
    Expect(orange.ToHex() == "#ffa500")
    Expect(Color32.Hex("#f00") == Color32.Red)
    Expect(Color32.TryHex("not a color") == Null)

    std/math/color.fb, line 30

    • Public Field r: UInt8 field #

      Its red, from 0 to 255.

    • Public Field g: UInt8 field #

      Its green, from 0 to 255.

    • Public Field b: UInt8 field #

      Its blue, from 0 to 255.

    • Public Field a: UInt8 field #

      Its alpha, from 0, transparent, to 255, opaque.

    • Public Static Property Transparent: Color32 property #

      No color at all: transparent black.

    • Public Static Property Black: Color32 property #

      Black.

    • Public Static Property White: Color32 property #

      White.

    • Public Static Property Gray: Color32 property #

      Gray, half way between black and white.

    • Public Static Property Red: Color32 property #

      Red.

    • Public Static Property Green: Color32 property #

      CSS's green, #008000, half as bright as a screen's green, which is Lime.

    • Public Static Property Lime: Color32 property #

      Lime, green at full strength.

    • Public Static Property Blue: Color32 property #

      Blue.

    • Public Static Property Yellow: Color32 property #

      Yellow.

    • Public Static Property Cyan: Color32 property #

      Cyan.

    • Public Static Property Magenta: Color32 property #

      Magenta.

    • Public Static Property Orange: Color32 property #

      Orange.

    • @PanicsAtCaller Public Static Method Hex(text: String): Color32 static method #

      The color hex text gives, as CSS writes one: "#rgb", "#rgba", "#rrggbb", or "#rrggbbaa", with or without the "#", in either case. Any other text panics; TryHex takes text from outside the program.

    • Public Static Method TryHex(text: String): Color32? static method #

      The color hex text gives, as Hex takes it, or Null for text that isn't one.

    • Public Method ToColor(): Color method #

      The color in linear Floats, through sRGB's gamma.

    • Public Method ToHex(): String method #

      The color as "#rrggbb", lowercase, or "#rrggbbaa" when it isn't opaque.

    • Public Method ToString(): String method #

      Its four bytes, as "(255, 165, 0, 255)".

    Report an issue with this page or with FutureBlitz on GitHub.