mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Fix label color foreground color
This commit is contained in:
parent
c5cb5d9514
commit
35a2e91fb8
1 changed files with 9 additions and 3 deletions
|
|
@ -87,13 +87,19 @@ public extension Color {
|
|||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
let colorR = channelColor(components[0]) * 0.2126
|
||||
let colorG = channelColor(components[1]) * 0.7152
|
||||
let colorB = channelColor(components[2]) * 0.0722
|
||||
|
||||
return Float(colorR + colorG + colorB)
|
||||
}
|
||||
|
||||
private func channelColor(_ channel: CGFloat) -> Double {
|
||||
channel <= 0.03928
|
||||
? channel / 12.92
|
||||
: pow((channel + 0.055) / 1.055, 2.4)
|
||||
}
|
||||
|
||||
static var isDarkMode: Bool {
|
||||
#if os(iOS)
|
||||
UITraitCollection.current.userInterfaceStyle == .dark
|
||||
|
|
|
|||
Loading…
Reference in a new issue