From 62fe8d58816cd16e361ca620a89facc780296cc7 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Sun, 18 Dec 2022 02:08:58 +0100 Subject: [PATCH] Fix some colors (#690) --- .../PickServer/CategoryPickerSection.swift | 4 ++-- .../PickServer/View/OnboardingNextView.swift | 2 +- .../MastodonServerRulesViewModel.swift | 23 ------------------- .../ServerRules/ServerRuleSection.swift | 2 +- .../OnboardingViewControllerAppearance.swift | 1 + .../Brand/Blurple.colorset/Contents.json | 20 ++++++++++++++++ .../Colors/Brand/Contents.json | 9 ++++++++ .../Light Blurple.colorset/Contents.json | 20 ++++++++++++++++ .../MastodonAsset/Generated/Assets.swift | 4 ++++ 9 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Blurple.colorset/Contents.json create mode 100644 MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Contents.json create mode 100644 MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Light Blurple.colorset/Contents.json diff --git a/Mastodon/Scene/Onboarding/PickServer/CategoryPickerSection.swift b/Mastodon/Scene/Onboarding/PickServer/CategoryPickerSection.swift index a6077c747..6ed299543 100644 --- a/Mastodon/Scene/Onboarding/PickServer/CategoryPickerSection.swift +++ b/Mastodon/Scene/Onboarding/PickServer/CategoryPickerSection.swift @@ -30,8 +30,8 @@ extension CategoryPickerSection { if cell.isSelected { textColor = .white - backgroundColor = Asset.Colors.Primary._700.color - borderColor = Asset.Colors.Primary._700.color + backgroundColor = Asset.Colors.Brand.blurple.color + borderColor = Asset.Colors.Brand.blurple.color } else { textColor = .label backgroundColor = .clear diff --git a/Mastodon/Scene/Onboarding/PickServer/View/OnboardingNextView.swift b/Mastodon/Scene/Onboarding/PickServer/View/OnboardingNextView.swift index ae124c088..836c30554 100644 --- a/Mastodon/Scene/Onboarding/PickServer/View/OnboardingNextView.swift +++ b/Mastodon/Scene/Onboarding/PickServer/View/OnboardingNextView.swift @@ -30,7 +30,7 @@ final class OnboardingNextView: UIView { let button = UIButton() button.translatesAutoresizingMaskIntoConstraints = false button.layer.cornerRadius = 14 - button.backgroundColor = Asset.Colors.brand.color + button.backgroundColor = Asset.Colors.Brand.blurple.color button.setTitle(L10n.Common.Controls.Actions.next, for: .normal) return button }() diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift index 945c92522..a4550e669 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift @@ -36,27 +36,4 @@ final class MastodonServerRulesViewModel { self.instance = instance self.applicationToken = applicationToken } - - var rulesAttributedString: NSAttributedString { - let attributedString = NSMutableAttributedString(string: "\n") - let configuration = UIImage.SymbolConfiguration(font: .preferredFont(forTextStyle: .title3)) - let separatorString = Array(repeating: " ", count: 4).joined() - for (i, rule) in rules.enumerated() { - guard i < 50 else { - return NSAttributedString(string: "\(i)" + separatorString + rule.text.trimmingCharacters(in: .whitespacesAndNewlines) + "\n\n") - } - let imageName = String(i + 1) + ".circle" - let image = UIImage(systemName: imageName, withConfiguration: configuration)! - let attachment = NSTextAttachment() - attachment.image = image.withTintColor(Asset.Colors.brand.color) - let imageAttribute = NSMutableAttributedString(attachment: attachment) - imageAttribute.addAttributes([NSAttributedString.Key.baselineOffset : -1.5], range: NSRange(location: 0, length: imageAttribute.length)) - - let ruleString = NSAttributedString(string: separatorString + rule.text.trimmingCharacters(in: .whitespacesAndNewlines) + "\n\n") - attributedString.append(imageAttribute) - attributedString.append(ruleString) - } - return attributedString - } - } diff --git a/Mastodon/Scene/Onboarding/ServerRules/ServerRuleSection.swift b/Mastodon/Scene/Onboarding/ServerRules/ServerRuleSection.swift index 4c589e041..ca4cd9c13 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/ServerRuleSection.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/ServerRuleSection.swift @@ -22,7 +22,7 @@ extension ServerRuleSection { case .rule(let ruleContext): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ServerRulesTableViewCell.self), for: indexPath) as! ServerRulesTableViewCell cell.indexImageView.image = UIImage(systemName: "\(ruleContext.index + 1).circle") ?? UIImage(systemName: "questionmark.circle") - cell.indexImageView.tintColor = Asset.Colors.brand.color + cell.indexImageView.tintColor = Asset.Colors.Brand.lightBlurple.color cell.ruleLabel.text = ruleContext.rule.text return cell } diff --git a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift index 89d77435d..0ccad9b60 100644 --- a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift +++ b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift @@ -60,6 +60,7 @@ extension OnboardingViewControllerAppearance { func setupNavigationBarAppearance() { // use TransparentBackground so view push / dismiss will be more visual nature // please add opaque background for status bar manually if needs + navigationController?.navigationBar.tintColor = Asset.Colors.Brand.blurple.color let barAppearance = UINavigationBarAppearance() barAppearance.configureWithTransparentBackground() diff --git a/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Blurple.colorset/Contents.json b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Blurple.colorset/Contents.json new file mode 100644 index 000000000..a7c6e8e3e --- /dev/null +++ b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Blurple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFB", + "green" : "0x2C", + "red" : "0x55" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Contents.json b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Contents.json new file mode 100644 index 000000000..6e965652d --- /dev/null +++ b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Contents.json @@ -0,0 +1,9 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "provides-namespace" : true + } +} diff --git a/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Light Blurple.colorset/Contents.json b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Light Blurple.colorset/Contents.json new file mode 100644 index 000000000..7dbe6e97d --- /dev/null +++ b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Colors/Brand/Light Blurple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFA", + "green" : "0x8A", + "red" : "0x85" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MastodonSDK/Sources/MastodonAsset/Generated/Assets.swift b/MastodonSDK/Sources/MastodonAsset/Generated/Assets.swift index 27914629d..f482d0be3 100644 --- a/MastodonSDK/Sources/MastodonAsset/Generated/Assets.swift +++ b/MastodonSDK/Sources/MastodonAsset/Generated/Assets.swift @@ -45,6 +45,10 @@ public enum Asset { public static let searchCard = ColorAsset(name: "Colors/Border/searchCard") public static let status = ColorAsset(name: "Colors/Border/status") } + public enum Brand { + public static let blurple = ColorAsset(name: "Colors/Brand/Blurple") + public static let lightBlurple = ColorAsset(name: "Colors/Brand/Light Blurple") + } public enum Button { public static let actionToolbar = ColorAsset(name: "Colors/Button/action.toolbar") public static let disabled = ColorAsset(name: "Colors/Button/disabled")