Import std.math.color
Color32
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)-
Its red, from 0 to 255.
-
Its green, from 0 to 255.
-
Its blue, from 0 to 255.
-
Its alpha, from 0, transparent, to 255, opaque.
-
No color at all: transparent black.
-
Black.
-
White.
-
Gray, half way between black and white.
-
Red.
-
CSS's green, #008000, half as bright as a screen's green, which is Lime.
-
Lime, green at full strength.
-
Blue.
-
Yellow.
-
Cyan.
-
Magenta.
-
Orange.
-
The color hex
textgives, as CSS writes one: "#rgb", "#rgba", "#rrggbb", or "#rrggbbaa", with or without the "#", in either case. Any other text panics; TryHex takestextfrom outside the program. -
The color hex
textgives, as Hex takes it, or Null fortextthat isn't one. -
The color in linear Floats, through sRGB's gamma.
-
The color as "#rrggbb", lowercase, or "#rrggbbaa" when it isn't opaque.
-
Its four bytes, as "(255, 165, 0, 255)".
Report an issue with this page or with FutureBlitz on GitHub.