This luminance function is meant to operate on RGB of 255 values

This commit is contained in:
Jackson Harper
2023-02-07 17:31:32 +08:00
parent d8392a64dd
commit d9a592f478

View File

@ -87,7 +87,11 @@ public extension Color {
}
#endif
return 0.2126 * Float(components[0]) + 0.7152 * Float(components[1]) + 0.0722 * Float(components[2])
let colorR = Double(Int(components[0] * 255)) * 0.2126
let colorG = Double(Int(components[1] * 255)) * 0.7152
let colorB = Double(Int(components[2] * 255)) * 0.0722
return Float(colorR + colorG + colorB)
}
static var isDarkMode: Bool {