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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
import UIKit
class FyColors{ static let isOpenDarkModel:Bool = true public class var labelTextColor: UIColor { return darkModeColor(dark:UIColor.white,light:UIColor.black) } public class var buttonTextColor: UIColor { return darkModeColor(dark:UIColor.white,light:UIColor.black) } public class var fieldTextColor: UIColor { return darkModeColor(dark:UIColor.white,light:UIColor.black) } public class var labelBgColor: UIColor { return darkModeColor(dark:UIColor.black,light:UIColor.white) } public class var buttonBgColor: UIColor { return darkModeColor(dark:UIColor.black,light:UIColor.white) } public class var viewBgColor: UIColor { return darkModeColor(dark:UIColor.black,light:UIColor.white) } class func isDarkStyle() -> Bool{ if(!isOpenDarkModel){ return false } if #available(iOS 13.0, *){ let currentMode = UITraitCollection.current.userInterfaceStyle if(currentMode == .dark){ return true } } return false } class func darkModeColor(dark:UIColor,light:UIColor) ->UIColor{ if(!isOpenDarkModel){ return light } if #available(iOS 13.0, *){ return UIColor{(trainCollection) -> UIColor in if trainCollection.userInterfaceStyle == .dark{ return dark }else{ return light } } } return light } }
|