DVUI

brightness

Returns brightness of the color as a value between 0 and 1

Parameters

#
self:@This()
@This()

Source

Implementation

#
pub fn brightness(self: @This()) f32 {
    const r: f32 = @as(f32, self.r) / 255.0;
    const g: f32 = @as(f32, self.g) / 255.0;
    const b: f32 = @as(f32, self.b) / 255.0;

    return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}