Swiftfin/Shared/Extensions/UIColor.swift
Daniel Chick fed9c654ef
Some checks failed
Build 🔨 / Build 🔨 (Swiftfin tvOS) (push) Has been cancelled
Build 🔨 / Build 🔨 (Swiftfin) (push) Has been cancelled
Resolve some todos (#1295)
* Partially resolve color todo

* Update localizations for quick connect steps. use bulleted list

* Same change for tvos

* Remove padding2 modifier

* Localisation
2024-10-29 11:17:56 -06:00

25 lines
642 B
Swift

//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import UIKit
extension UIColor {
var overlayColor: UIColor {
var red: CGFloat = 0
var green: CGFloat = 0
var blue: CGFloat = 0
var alpha: CGFloat = 0
getRed(&red, green: &green, blue: &blue, alpha: &alpha)
let brightness = ((red * 299) + (green * 587) + (blue * 114)) / 1000
return brightness < 0.5 ? .white : .black
}
}