Panes/src/colors.zig

35 lines
697 B
Zig
Raw Normal View History

2024-07-25 19:48:17 +00:00
pub const Color = struct {
type: enum { Default, RGB },
red: u8,
green: u8,
blue: u8,
pub fn equal(self: Color, other: Color) bool {
if (self.type != other.type) {
return false;
}
if (self.type == .Default) {
return true;
}
return self.red == other.red and self.green == other.green and self.blue == self.blue;
}
};
pub const Default = Color{
.type = .Default,
.red = undefined,
.green = undefined,
.blue = undefined,
};
pub inline fn RGB(red: u8, green: u8, blue: u8) Color {
return .{
.type = .RGB,
.red = red,
.green = green,
.blue = blue,
};
}