summaryrefslogtreecommitdiff
path: root/src/color.zig
blob: e27ccb2fb6e4d88a5a34c7770ba351bd02eb6d1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const std = @import("std");

pub fn Rgba(comptime bits: u16) type {
    const Uint = std.meta.Int(.unsigned, bits);
    return packed struct {
        const Self = @This();

        red: Uint,
        green: Uint,
        blue: Uint,
        alpha: Uint,

        pub fn init(r: Uint, g: Uint, b: Uint, a: Uint) Self {
            return .{
                .red = r,
                .green = g,
                .blue = b,
                .alpha = a,
            };
        }
    };
}