element-ios/Riot/Managers/Theme/Themes/DarkTheme.swift

97 lines
3.5 KiB
Swift
Raw Normal View History

/*
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import Foundation
import UIKit
2019-01-11 17:29:32 +00:00
/// Color constants for the dark theme
@objcMembers
class DarkTheme: NSObject, Theme {
2019-02-12 17:54:39 +00:00
var backgroundColor: UIColor = UIColor(rgb: 0x181B21)
2019-02-19 08:36:43 +00:00
var baseColor: UIColor = UIColor(rgb: 0x15171B)
2019-02-12 17:54:39 +00:00
var baseTextPrimaryColor: UIColor = UIColor(rgb: 0xEDF3FF)
var baseTextSecondaryColor: UIColor = UIColor(rgb: 0xEDF3FF)
2019-02-12 17:54:39 +00:00
var searchBackgroundColor: UIColor = UIColor(rgb: 0x181B21)
var searchPlaceholderColor: UIColor = UIColor(rgb: 0x61708B)
2019-02-19 08:36:43 +00:00
var headerBackgroundColor: UIColor = UIColor(rgb: 0x15171B)
var headerBorderColor: UIColor = UIColor(rgb: 0x22262E)
2019-02-12 17:54:39 +00:00
var headerTextPrimaryColor: UIColor = UIColor(rgb: 0xA1B2D1)
var headerTextSecondaryColor: UIColor = UIColor(rgb: 0xC8C8CD)
2019-02-12 17:54:39 +00:00
var textPrimaryColor: UIColor = UIColor(rgb: 0xEDF3FF)
var textSecondaryColor: UIColor = UIColor(rgb: 0xA1B2D1)
2019-02-12 17:54:39 +00:00
var tintColor: UIColor = UIColor(rgb: 0x03B381)
var unreadRoomIndentColor: UIColor = UIColor(rgb: 0x2E3648)
var lineBreakColor: UIColor = UIColor(rgb: 0x61708B)
var noticeColor: UIColor = UIColor(rgb: 0xFF4B55)
var noticeSecondaryColor: UIColor = UIColor(rgb: 0x61708B)
2019-02-12 17:54:39 +00:00
var warningColor: UIColor = UIColor(rgb: 0xFF4B55)
var avatarColors: [UIColor] = [
2019-02-12 17:54:39 +00:00
UIColor(rgb: 0x03B381),
UIColor(rgb: 0x368BD6),
UIColor(rgb: 0xAC3BA8)]
var statusBarStyle: UIStatusBarStyle = .lightContent
var scrollBarStyle: UIScrollView.IndicatorStyle = .white
var keyboardAppearance: UIKeyboardAppearance = .dark
var placeholderTextColor: UIColor = UIColor(white: 1.0, alpha: 0.3)
var selectedBackgroundColor: UIColor? = UIColor.black
var overlayBackgroundColor: UIColor = UIColor(white: 0.7, alpha: 0.5)
var matrixSearchBackgroundImageTintColor: UIColor = UIColor(rgb: 0x7E7E7E)
func applyStyle(onTabBar tabBar: UITabBar) {
tabBar.tintColor = self.tintColor;
tabBar.barTintColor = self.headerBackgroundColor;
tabBar.isTranslucent = false;
}
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
navigationBar.tintColor = self.baseTextPrimaryColor;
navigationBar.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: self.baseTextPrimaryColor
]
navigationBar.barTintColor = self.baseColor;
// The navigation bar needs to be opaque so that its background color is the expected one
navigationBar.isTranslucent = false;
}
func applyStyle(onSearchBar searchBar: UISearchBar) {
searchBar.barStyle = .black
searchBar.tintColor = self.searchPlaceholderColor;
2019-02-19 08:40:38 +00:00
searchBar.barTintColor = self.headerBackgroundColor;
}
func applyStyle(onTextField texField: UITextField) {
texField.textColor = self.textPrimaryColor
texField.tintColor = self.tintColor
}
func applyStyle(onButton button: UIButton) {
// NOTE: Tint color does nothing by default on button type `UIButtonType.custom`
button.tintColor = self.tintColor
}
}