Create Theme v2 and define colors in palette

This commit is contained in:
ismailgulek
2021-04-30 15:59:24 +03:00
parent 1a160e71f7
commit 0b6c4fc8dc
4 changed files with 191 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
//
// Copyright 2021 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
/// Colors at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1255%3A1104
@objc public protocol Colors {
var accent: UIColor { get }
var alert: UIColor { get }
var primaryContent: UIColor { get }
var secondaryContent: UIColor { get }
var tertiaryContent: UIColor { get }
var quarterlyContent: UIColor { get }
var separator: UIColor { get }
var toast: UIColor { get }
var tile: UIColor { get }
var navigation: UIColor { get }
var background: UIColor { get }
var namesAndAvatars: [UIColor] { get }
}

View File

@@ -0,0 +1,28 @@
//
// Copyright 2021 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
/// Theme v2. May be named again as `Theme` when the migration completed.
@objc public protocol ThemeV2 {
/// Colors object
var colors: Colors { get }
/// may contain more design components in future, like icons, audio files etc.
}

View File

@@ -0,0 +1,58 @@
//
// Copyright 2021 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
/// Dark theme colors. Will be a struct when things are more Swifty.
public class DarkColors: Colors {
public let accent: UIColor = UIColor(rgb: 0x0DBD8B)
public let alert: UIColor = UIColor(rgb: 0xFF4B55)
public let primaryContent: UIColor = UIColor(rgb: 0xFFFFFF)
public let secondaryContent: UIColor = UIColor(rgb: 0xA9B2BC)
public let tertiaryContent: UIColor = UIColor(rgb: 0x8E99A4)
public let quarterlyContent: UIColor = UIColor(rgb: 0x6F7882)
public let separator: UIColor = UIColor(rgb: 0x21262C)
public let toast: UIColor = UIColor(rgb: 0xFFFFFF)
public let tile: UIColor = UIColor(rgb: 0x394049)
public let navigation: UIColor = UIColor(rgb: 0x21262C)
public let background: UIColor = UIColor(rgb: 0x15191E)
public let namesAndAvatars: [UIColor] = [
UIColor(rgb: 0x368BD6),
UIColor(rgb: 0xAC3BA8),
UIColor(rgb: 0x03B381),
UIColor(rgb: 0xE64F7A),
UIColor(rgb: 0xFF812D),
UIColor(rgb: 0x2DC2C5),
UIColor(rgb: 0x5C56F5),
UIColor(rgb: 0x74D12C)
]
public init() {}
}

View File

@@ -0,0 +1,58 @@
//
// Copyright 2021 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
/// Default (light) theme colors. Will be a struct when things are more Swifty.
public class DefaultColors: Colors {
public let accent: UIColor = UIColor(rgb: 0x0DBD8B)
public let alert: UIColor = UIColor(rgb: 0xFF4B55)
public let primaryContent: UIColor = UIColor(rgb: 0x17191C)
public let secondaryContent: UIColor = UIColor(rgb: 0x737D8C)
public let tertiaryContent: UIColor = UIColor(rgb: 0x8D97A5)
public let quarterlyContent: UIColor = UIColor(rgb: 0xC1C6CD)
public let separator: UIColor = UIColor(rgb: 0xE3E8F0)
public let toast: UIColor = UIColor(rgb: 0xF4F6FA)
public let tile: UIColor = UIColor(rgb: 0xF3F8FD)
public let navigation: UIColor = UIColor(rgb: 0xF4F6FA)
public let background: UIColor = UIColor(rgb: 0xFFFFFF)
public let namesAndAvatars: [UIColor] = [
UIColor(rgb: 0x368BD6),
UIColor(rgb: 0xAC3BA8),
UIColor(rgb: 0x03B381),
UIColor(rgb: 0xE64F7A),
UIColor(rgb: 0xFF812D),
UIColor(rgb: 0x2DC2C5),
UIColor(rgb: 0x5C56F5),
UIColor(rgb: 0x74D12C)
]
public init() {}
}