mirror of
https://github.com/jellyfin/Swiftfin.git
synced 2024-11-23 05:59:51 +00:00
fed9c654ef
* Partially resolve color todo * Update localizations for quick connect steps. use bulleted list * Same change for tvos * Remove padding2 modifier * Localisation
25 lines
642 B
Swift
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
|
|
}
|
|
}
|