Browse Source

improved dark mode

marinofaggiana 4 năm trước cách đây
mục cha
commit
a6c798e86c
2 tập tin đã thay đổi với 14 bổ sung10 xóa
  1. 11 7
      iOSClient/Brand/NCBrand.swift
  2. 3 3
      iOSClient/Main/NCMainTabBar.swift

+ 11 - 7
iOSClient/Brand/NCBrand.swift

@@ -154,6 +154,15 @@ class NCBrandColor: NSObject {
             }
         }
     }
+    @objc public var secondarySystemBackground: UIColor {
+        get {
+            if #available(iOS 13, *) {
+                return .secondarySystemBackground
+            } else {
+                return UIColor(red: 95.0/255.0, green: 95.0/255.0, blue: 97.0/255.0, alpha: 1.0)
+            }
+        }
+    }
     @objc public var systemGroupedBackground: UIColor {
         get {
             if #available(iOS 13, *) {
@@ -176,7 +185,6 @@ class NCBrandColor: NSObject {
     @objc public var backgroundViewForm:    UIColor = .white
     @objc public var cellSettings:          UIColor = .white
     @objc public var separator:             UIColor = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
-    @objc public var tabBar:                UIColor = .white
     @objc public let nextcloud:             UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)
     @objc public let nextcloudSoft:         UIColor = UIColor(red: 90.0/255.0, green: 160.0/255.0, blue: 210.0/255.0, alpha: 1.0)
     @objc public let icon:                  UIColor = UIColor(red: 104.0/255.0, green: 104.0/255.0, blue: 104.0/255.0, alpha: 1.0)
@@ -225,9 +233,7 @@ class NCBrandColor: NSObject {
     @objc public func setDarkMode(_ dark: Bool) {
 
         if dark {
-            
-            tabBar = UIColor(red: 28.0/255.0, green: 28.0/255.0, blue: 30.0/255.0, alpha: 1.0)                          // Gray (6) Dark
-            
+                        
             backgroundViewForm = UIColor(red: 28.0/255.0, green: 28.0/255.0, blue: 30.0/255.0, alpha: 1.0)              // Gray (6) Dark
 
             cellSettings = UIColor(red: 28.0/255.0, green: 28.0/255.0, blue: 30.0/255.0, alpha: 1.0)                    // Gray (6) Dark
@@ -236,9 +242,7 @@ class NCBrandColor: NSObject {
             select = UIColor.white.withAlphaComponent(0.2)
             
         } else {
-            
-            tabBar = .white
-            
+                        
             backgroundViewForm = .white
 
             cellSettings = .white

+ 3 - 3
iOSClient/Main/NCMainTabBar.swift

@@ -48,8 +48,9 @@ class NCMainTabBar: UITabBar {
             appDelegate.darkMode = false
         }
         
-        barTintColor = NCBrandColor.shared.systemBackground
-
+        barTintColor = NCBrandColor.shared.secondarySystemBackground
+        backgroundColor = NCBrandColor.shared.secondarySystemBackground
+        
         changeTheming()
     }
     
@@ -64,7 +65,6 @@ class NCMainTabBar: UITabBar {
     }
     
     @objc func changeTheming() {
-        backgroundColor = NCBrandColor.shared.tabBar
         tintColor = NCBrandColor.shared.brandElement
         if let centerButton = self.viewWithTag(99) {
             centerButton.backgroundColor = NCBrandColor.shared.brandElement