mac/title: remove old libmpv color setter fallback
This commit is contained in:
1 parent
51af3caa77
commit
cd9fa6daf0
2 files changed
+5
-24
No files matched your search
@@ -47,18 +47,6 @@ extension NSScreen {
|
||||
}
|
||||
}
|
||||
|
||||
extension NSColor {
|
||||
convenience init(hex: String) {
|
||||
let int = Int(hex.dropFirst(), radix: 16) ?? 0
|
||||
let alpha = CGFloat((int >> 24) & 0x000000FF)/255
|
||||
let red = CGFloat((int >> 16) & 0x000000FF)/255
|
||||
let green = CGFloat((int >> 8) & 0x000000FF)/255
|
||||
let blue = CGFloat((int) & 0x000000FF)/255
|
||||
|
||||
self.init(calibratedRed: red, green: green, blue: blue, alpha: alpha)
|
||||
}
|
||||
}
|
||||
|
||||
extension NSEvent.ModifierFlags {
|
||||
public static var optionLeft: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICELALTKEYMASK))
|
||||
public static var optionRight: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICERALTKEYMASK))
|
||||
|
||||
@@ -132,18 +132,11 @@ class TitleBar: NSVisualEffectView {
|
||||
}()
|
||||
}
|
||||
|
||||
func set(color: Any) {
|
||||
if color is String {
|
||||
layer?.backgroundColor = NSColor(hex: color as? String ?? "#00000000").cgColor
|
||||
} else {
|
||||
let col = color as? m_color ?? m_color(r: 0, g: 0, b: 0, a: 0)
|
||||
let red = CGFloat(col.r)/255
|
||||
let green = CGFloat(col.g)/255
|
||||
let blue = CGFloat(col.b)/255
|
||||
let alpha = CGFloat(col.a)/255
|
||||
layer?.backgroundColor = NSColor(calibratedRed: red, green: green,
|
||||
blue: blue, alpha: alpha).cgColor
|
||||
}
|
||||
func set(color: m_color) {
|
||||
layer?.backgroundColor = NSColor(calibratedRed: CGFloat(color.r)/255,
|
||||
green: CGFloat(color.g)/255,
|
||||
blue: CGFloat(color.b)/255,
|
||||
alpha: CGFloat(color.a)/255).cgColor
|
||||
}
|
||||
|
||||
func show() {
|
||||
|
||||
Reference in new issue
Block a user