From d9a592f478c86714e29e7e575c99c2ae1ec7b07e Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 7 Feb 2023 17:31:32 +0800 Subject: [PATCH] This luminance function is meant to operate on RGB of 255 values --- apple/OmnivoreKit/Sources/Utils/ColorUtils.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Utils/ColorUtils.swift b/apple/OmnivoreKit/Sources/Utils/ColorUtils.swift index f9d314e72..fa61a9664 100644 --- a/apple/OmnivoreKit/Sources/Utils/ColorUtils.swift +++ b/apple/OmnivoreKit/Sources/Utils/ColorUtils.swift @@ -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 {