pub const Color = packed struct(u32) { const Self = @This(); blue: u8, green: u8, red: u8, _padding: u8 = 0x0, pub fn mix(self: *const Self, other: *const Self, factor: f64) Self { const inverse = 1 - factor; return Self { .red = @intFromFloat( @as(f64, @floatFromInt(self.red)) * inverse + @as(f64, @floatFromInt(other.red)) * factor ), .green = @intFromFloat( @as(f64, @floatFromInt(self.green)) * inverse + @as(f64, @floatFromInt(other.green)) * factor ), .blue = @intFromFloat( @as(f64, @floatFromInt(self.blue)) * inverse + @as(f64, @floatFromInt(other.blue)) * factor ), }; } };