1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#if os(iOS) import UIKit typealias HSColor = UIColor typealias HSFont = UIFont typealias HSImage = UIImage typealias HSView = UIView #elseif os(macOS) import AppKit typealias HSColor = NSColor typealias HSFont = NSFont typealias HSImage = NSImage typealias HSView = NSView extension NSFont { public class func italicSystemFont(ofSize fontSize: CGFloat) -> NSFont { let f = NSFontManager.shared.font(withFamily: "System", traits: .italicFontMask, weight: 0, size: fontSize) return f! } } extension NSColor { static var darkText: HSColor { return HSColor.black } static var lightText: HSColor { return HSColor.white } static var label: HSColor { return HSColor.labelColor } } #endif |
Categories