Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tint color in wpios #23946

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extension WPStyleGuide {
// looking the same on newer versions of iOS.
UIStackView.appearance().backgroundColor = .clear

UIWindow.appearance().tintColor = UIAppColor.brand
UISwitch.appearance().onTintColor = UIAppColor.brand
UIWindow.appearance().tintColor = UIAppColor.primary
UISwitch.appearance().onTintColor = UIAppColor.primary

UITableView.appearance().sectionHeaderTopPadding = 0

Expand Down Expand Up @@ -164,7 +164,7 @@ extension WPStyleGuide {
@objc
class func configureTableViewActionCell(_ cell: UITableViewCell?) {
configureTableViewCell(cell)
cell?.textLabel?.textColor = UIAppColor.brand
cell?.textLabel?.textColor = UIAppColor.primary
}

@objc
Expand Down
22 changes: 5 additions & 17 deletions WordPress/Classes/Utility/App Configuration/AppColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,17 @@ struct UIAppColor {
#if IS_JETPACK
static let tint = UIColor.label

static let brand = UIColor(light: CSColor.JetpackGreen.shade(.shade40), dark: CSColor.JetpackGreen.shade(.shade30))

static func brand(_ shade: ColorStudioShade) -> UIColor {
CSColor.JetpackGreen.shade(shade)
}

static let primary = CSColor.JetpackGreen.base
static let primary = UIColor(light: CSColor.JetpackGreen.shade(.shade40), dark: CSColor.JetpackGreen.shade(.shade30))

static func primary(_ shade: ColorStudioShade) -> UIColor {
CSColor.JetpackGreen.shade(shade)
}
#endif

#if IS_WORDPRESS
static let tint = brand

static let brand = CSColor.WordPressBlue.base

static func brand(_ shade: ColorStudioShade) -> UIColor {
CSColor.WordPressBlue.shade(shade)
}
static let tint = primary

static let primary = CSColor.Blue.base
static let primary = UIColor(light: CSColor.Blue.base, dark: primary(.shade40))

static func primary(_ shade: ColorStudioShade) -> UIColor {
CSColor.Blue.shade(shade)
Expand Down Expand Up @@ -142,10 +130,10 @@ struct UIAppColor {

static let prologueBackground = UIColor(light: blue(.shade0), dark: .systemBackground)

static let switchStyle: SwitchToggleStyle = SwitchToggleStyle(tint: Color(UIAppColor.brand))
static let switchStyle: SwitchToggleStyle = SwitchToggleStyle(tint: Color(UIAppColor.primary))
}

struct AppColor {
static let tint = Color(UIAppColor.tint)
static let brand = Color(UIAppColor.brand)
static let primary = Color(UIAppColor.primary)
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct ZendeskAttachmentsSection: View {
Image(systemName: "paperclip")
Text(Strings.addAttachment)
}
.foregroundStyle(Color(uiColor: UIAppColor.brand))
.foregroundStyle(Color(uiColor: UIAppColor.primary))
}
.onChange(of: selection, perform: viewModel.process)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
let hyperlinkText = NSAttributedString(string: Constants.hyperlinkText, attributes: [
.paragraphStyle: paragraphStyle,
.attachment: attachmentURL,
.foregroundColor: UIAppColor.brand
.foregroundColor: UIAppColor.primary
])
attributedString.append(hyperlinkText)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CommentContentTableViewCell: UITableViewCell, NibReusable {

@objc var isReplyHighlighted: Bool = false {
didSet {
replyButton.tintColor = isReplyHighlighted ? UIAppColor.brand : .label
replyButton.tintColor = isReplyHighlighted ? UIAppColor.primary : .label
replyButton.configuration?.image = UIImage(systemName: isReplyHighlighted ? "arrowshape.turn.up.left.fill" : "arrowshape.turn.up.left")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct SiteDomainsView: View {
} label: {
Text(TextContent.additionalDomainTitle(blog.canRegisterDomainWithPaidPlan))
.style(TextStyle.bodyMedium(.regular))
.foregroundColor(AppColor.brand)
.foregroundColor(AppColor.primary)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct CompliancePopover: View {
.font(.body)
}
}
.foregroundColor(AppColor.brand)
.foregroundColor(AppColor.primary)
.frame(height: 44)
}

Expand All @@ -70,7 +70,7 @@ struct CompliancePopover: View {
}) {
ZStack {
RoundedRectangle(cornerRadius: 8)
.fill(AppColor.brand)
.fill(AppColor.primary)
Text(Strings.saveButtonTitle)
.font(.body)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ private extension JetpackRemoteInstallStateView {
}

struct MainButton {
static let normalBackground = UIImage.renderBackgroundImage(fill: UIAppColor.brand)
static let normalBackground = UIImage.renderBackgroundImage(fill: UIAppColor.primary)
static let loadingBackground = UIImage.renderBackgroundImage(fill: UIAppColor.jetpackGreen(.shade70))
static let titleColor = UIColor.white
static let font = WPStyleGuide.fontForTextStyle(.body, fontWeight: .semibold)
static let activityIndicatorColor = UIColor.white
}

struct SupportButton {
static let color = UIAppColor.brand
static let color = UIAppColor.primary
static let font = WPStyleGuide.fontForTextStyle(.body)
static let text = NSLocalizedString("Contact Support", comment: "Contact Support button title")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct DomainPurchaseChoicesView: View {
Image(imageName)
.renderingMode(.template)
.resizable()
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
.frame(width: Constants.imageLength, height: Constants.imageLength)
.padding(.top, .DS.Padding.double)
VStack(alignment: .leading, spacing: .DS.Padding.single) {
Expand All @@ -95,7 +95,7 @@ struct DomainPurchaseChoicesView: View {
.foregroundStyle(.secondary)
if let footer {
Text(footer)
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
.font(.body.bold())
}
}
Expand All @@ -122,7 +122,7 @@ struct DomainPurchaseChoicesView: View {
Text(Strings.chooseSiteSubtitle)
.foregroundStyle(Color(.secondaryLabel))
Text(Strings.chooseSiteFooter)
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct BooleanUserDefaultsDebugView: View {
.onAppear {
viewModel.load()
}
.tint(AppColor.brand)
.tint(AppColor.primary)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ final class NotificationTableViewCell: HostingTableViewCell<NotificationsTableVi

private func likeInlineActionIcon(filled: Bool) -> (image: Image, color: Color?) {
let image: Image = Image.DS.icon(named: filled ? .starFill : .starOutline)
let color: Color? = filled ? AppColor.brand: nil
let color: Color? = filled ? AppColor.primary: nil
return (image: image, color: color)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ import Gridicons
// Reply button
replyButton.configuration = {
var configuration = UIButton.Configuration.plain()
configuration.baseForegroundColor = UIAppColor.brand
configuration.baseForegroundColor = UIAppColor.primary
configuration.title = NSLocalizedString("Reply", comment: "Reply to a comment.")
return configuration
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct PublishDatePickerView: View {
.environment(\.defaultMinListHeaderHeight, 0)
.navigationTitle(Strings.title)
.navigationBarTitleDisplayMode(.inline)
.tint(Color(uiColor: UIAppColor.brand))
.tint(Color(uiColor: UIAppColor.primary))
}

private var dateRow: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct MediaUploadProgressView: View {
.stroke(Color.secondary.opacity(0.25), lineWidth: 2)
Circle()
.trim(from: 0, to: progress)
.stroke(Color(uiColor: UIAppColor.brand), style: StrokeStyle(lineWidth: 2, lineCap: .round))
.stroke(Color(uiColor: UIAppColor.primary), style: StrokeStyle(lineWidth: 2, lineCap: .round))
.rotationEffect(.degrees(-90))
.animation(.easeOut, value: progress)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private final class ReaderPostCellView: UIView {
buttons.bookmark.configuration = {
var configuration = buttons.bookmark.configuration ?? .plain()
configuration.image = UIImage(systemName: viewModel.isBookmarked ? "bookmark.fill" : "bookmark")
configuration.baseForegroundColor = viewModel.isBookmarked ? UIAppColor.brand : .secondaryLabel
configuration.baseForegroundColor = viewModel.isBookmarked ? UIAppColor.primary : .secondaryLabel
return configuration
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private final class ReaderRecommendedSitesCellView: UIView {
let buttonSubscribe = UIButton(configuration: {
var configuration = UIButton.Configuration.plain()
configuration.image = UIImage(systemName: "plus.circle")
configuration.baseForegroundColor = UIAppColor.brand
configuration.baseForegroundColor = UIAppColor.primary
configuration.contentInsets = .zero
return configuration
}())
Expand Down Expand Up @@ -160,7 +160,7 @@ private final class ReaderRecommendedSitesCellView: UIView {
buttonSubscribe.configuration?.baseForegroundColor = .secondaryLabel
ReaderSubscriptionHelper().toggleFollowingForSite(site) { [weak self] _ in
self?.buttonSubscribe.configuration?.showsActivityIndicator = false
self?.buttonSubscribe.configuration?.baseForegroundColor = UIAppColor.brand
self?.buttonSubscribe.configuration?.baseForegroundColor = UIAppColor.primary
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct ReaderSearchSuggestionsView: View {
viewModel.buttonClearSearchHistoryTapped()
} label: {
Text(Strings.clearHistory)
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ struct ReaderSidebarTagsSection: View {
} label: {
Label(Strings.addTag, systemImage: "plus.circle")
}
.listItemTint(AppColor.brand)
.listItemTint(AppColor.primary)

Button {
viewModel.navigate(.discoverTags)
} label: {
Label(Strings.discoverTags, systemImage: "sparkle.magnifyingglass")
}
.listItemTint(AppColor.brand)
.listItemTint(AppColor.primary)
}

func delete(at offsets: IndexSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private struct ReaderSidebarView: View {
makeSection(Strings.subscriptions, isExpanded: $isSectionSubscriptionsExpanded) {
Label(Strings.subscriptions, systemImage: "checkmark.rectangle.stack")
.tag(ReaderSidebarItem.allSubscriptions)
.listItemTint(AppColor.brand)
.listItemTint(AppColor.primary)
.withDisabledSelection(isEditing)

ReaderSidebarSubscriptionsSection(viewModel: viewModel)
Expand Down Expand Up @@ -206,7 +206,7 @@ private struct ReaderSidebarSection<Content: View>: View {
Spacer()
Image(systemName: isExpanded ? "chevron.down" : "chevron.forward")
.font(.system(size: 14).weight(.semibold))
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
.frame(width: 14)
}
.contentShape(Rectangle())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ extension WPStyleGuide {
static let buttonTitleLabelFont = WPStyleGuide.fontForTextStyle(.body, fontWeight: .semibold)
static let buttonBorderColor = UIColor.systemGray3
static let switchOnTintColor = UIColor.systemGreen
static let switchInProgressTintColor = UIAppColor.brand
static let switchInProgressTintColor = UIAppColor.primary
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ struct ReaderSubscriptionCell: View {
switch status {
case .all:
Image(systemName: "bell.and.waves.left.and.right")
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
case .personalized:
Image(systemName: "bell")
.foregroundStyle(AppColor.brand)
.foregroundStyle(AppColor.primary)
case .none:
Image(systemName: "bell.slash")
.foregroundStyle(.secondary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ private extension CountriesMapView {

func mapColors() -> [UIColor] {
if traitCollection.userInterfaceStyle == .dark {
return [WPStyleGuide.Stats.mapBackground, UIAppColor.brand]
return [WPStyleGuide.Stats.mapBackground, UIAppColor.primary]
} else {
return [WPStyleGuide.Stats.mapBackground, UIAppColor.brand]
return [WPStyleGuide.Stats.mapBackground, UIAppColor.primary]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private struct SidebarProfileContainerView: View {
}
}
}
.tint(Color(UIAppColor.brand))
.tint(Color(UIAppColor.primary))
}

Spacer()
Expand Down Expand Up @@ -247,7 +247,7 @@ struct SidebarAddButtonLabel: View {
Text(title)
} icon: {
Image(systemName: "plus.square.fill")
.foregroundStyle(AppColor.brand, Color(.secondarySystemFill))
.foregroundStyle(AppColor.primary, Color(.secondarySystemFill))
.font(.title2)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fileprivate extension NotificationsTableViewCellContent {

private var indicator: some View {
Circle()
.fill(AppColor.brand)
.fill(AppColor.primary)
.frame(width: .DS.Padding.single)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private struct AudiowaveView: View {
ForEach(indices, id: \.self) { index in
let height = max(10, 80 * normalizePowerLevel(samples[index]))
Capsule(style: .continuous)
.fill(Color(uiColor: UIAppColor.brand))
.fill(Color(uiColor: UIAppColor.primary))
.frame(width: 10, height: CGFloat(height))
.animation(.spring(duration: 0.1), value: height)
}
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Classes/ViewRelated/Voice/VoiceToContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct VoiceToContentView: View {
var body: some View {
contents
.onAppear(perform: viewModel.onViewAppeared)
.tint(Color(uiColor: UIAppColor.brand))
.tint(Color(uiColor: UIAppColor.primary))
.alert(viewModel.errorAlertMessage ?? "", isPresented: $viewModel.isShowingErrorAlert, actions: {
Button(SharedStrings.Button.ok, action: buttonCancelTapped)
})
Expand Down Expand Up @@ -150,7 +150,7 @@ private struct RecordButton: View {

private var backgroundColor: Color {
if !isRecording {
return viewModel.isButtonRecordEnabled ? Color(uiColor: UIAppColor.brand) : Color.secondary.opacity(0.5)
return viewModel.isButtonRecordEnabled ? Color(uiColor: UIAppColor.primary) : Color.secondary.opacity(0.5)
}
return .black
}
Expand Down
Loading