Skip to content

Commit

Permalink
Refactor FXIOS-8980 Align colour token names with desktop (#22763)
Browse files Browse the repository at this point in the history
* Rename layerConfirmation to layerSuccess

* Rename layerError to layerCritical

* Rename layerInfo to layerInformation

* Rename actionConfirmation to actionSuccess

* Rename actionError to actionCritical

* Rename actionInfo to

* Rename textWarning to textCritical

* Rename iconAction to iconAccent

* Rename iconWarning to iconCritical
  • Loading branch information
thatswinnie authored Oct 25, 2024
1 parent 2a44c75 commit 654ea9d
Show file tree
Hide file tree
Showing 27 changed files with 75 additions and 75 deletions.
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/DarkTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ private struct DarkColourPalette: ThemeColourPalette {
FXColors.DarkGrey60.withAlphaComponent(1),
FXColors.DarkGrey60.withAlphaComponent(1)
])
var layerInfo: UIColor = FXColors.Blue50
var layerConfirmation: UIColor = FXColors.Green80
var layerInformation: UIColor = FXColors.Blue50
var layerSuccess: UIColor = FXColors.Green80
var layerWarning: UIColor = FXColors.Yellow70.withAlphaComponent(0.77)
var layerError: UIColor = FXColors.Pink80
var layerCritical: UIColor = FXColors.Pink80
var layerSelectedText: UIColor = FXColors.Blue40
var layerAutofillText: UIColor = FXColors.LightGrey05.withAlphaComponent(0.34)
var layerSearch: UIColor = FXColors.DarkGrey80
Expand Down Expand Up @@ -77,18 +77,18 @@ private struct DarkColourPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey90
var indicatorInactive: UIColor = FXColors.DarkGrey05
var actionConfirmation: UIColor = FXColors.Green70
var actionSuccess: UIColor = FXColors.Green70
var actionWarning: UIColor = FXColors.Yellow40.withAlphaComponent(0.41)
var actionError: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInfo: UIColor = FXColors.Blue60
var actionCritical: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInformation: UIColor = FXColors.Blue60
var actionTabActive: UIColor = FXColors.DarkGrey30
var actionTabInactive: UIColor = FXColors.DarkGrey80

// MARK: - Text
var textPrimary: UIColor = FXColors.LightGrey05
var textSecondary: UIColor = FXColors.LightGrey40
var textDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red20
var textCritical: UIColor = FXColors.Red20
var textAccent: UIColor = FXColors.Blue30
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -99,9 +99,9 @@ private struct DarkColourPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.LightGrey05
var iconSecondary: UIColor = FXColors.LightGrey40
var iconDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue30
var iconAccent: UIColor = FXColors.Blue30
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red20
var iconCritical: UIColor = FXColors.Red20
var iconSpinner: UIColor = FXColors.White
var iconAccentViolet: UIColor = FXColors.Violet20
var iconAccentBlue: UIColor = FXColors.Blue30
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/LightTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ private struct LightColourPalette: ThemeColourPalette {
FXColors.LightGrey10.withAlphaComponent(1),
FXColors.LightGrey10.withAlphaComponent(1)
])
var layerInfo: UIColor = FXColors.Blue50.withAlphaComponent(0.44)
var layerConfirmation: UIColor = FXColors.Green20
var layerInformation: UIColor = FXColors.Blue50.withAlphaComponent(0.44)
var layerSuccess: UIColor = FXColors.Green20
var layerWarning: UIColor = FXColors.Yellow20
var layerError: UIColor = FXColors.Red10
var layerCritical: UIColor = FXColors.Red10
var layerSelectedText: UIColor = FXColors.Blue50
var layerAutofillText: UIColor = FXColors.DarkGrey05.withAlphaComponent(0.73)
var layerSearch: UIColor = FXColors.LightGrey30
Expand Down Expand Up @@ -66,18 +66,18 @@ private struct LightColourPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey50
var indicatorInactive: UIColor = FXColors.LightGrey30
var actionConfirmation: UIColor = FXColors.Green60
var actionSuccess: UIColor = FXColors.Green60
var actionWarning: UIColor = FXColors.Yellow60.withAlphaComponent(0.4)
var actionError: UIColor = FXColors.Red30
var actionInfo: UIColor = FXColors.Blue50
var actionCritical: UIColor = FXColors.Red30
var actionInformation: UIColor = FXColors.Blue50
var actionTabActive: UIColor = FXColors.White
var actionTabInactive: UIColor = FXColors.LightGrey20

// MARK: - Text
var textPrimary: UIColor = FXColors.DarkGrey90
var textSecondary: UIColor = FXColors.DarkGrey05
var textDisabled: UIColor = FXColors.DarkGrey90.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red70
var textCritical: UIColor = FXColors.Red70
var textAccent: UIColor = FXColors.Blue50
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -88,9 +88,9 @@ private struct LightColourPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.DarkGrey90
var iconSecondary: UIColor = FXColors.DarkGrey05
var iconDisabled: UIColor = FXColors.DarkGrey90.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue50
var iconAccent: UIColor = FXColors.Blue50
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red70
var iconCritical: UIColor = FXColors.Red70
var iconSpinner: UIColor = FXColors.LightGrey80
var iconAccentViolet: UIColor = FXColors.Violet60
var iconAccentBlue: UIColor = FXColors.Blue60
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/PrivateModeTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
FXColors.Violet80,
FXColors.Purple70
])
var layerInfo: UIColor = FXColors.Blue50
var layerConfirmation: UIColor = FXColors.Green80
var layerInformation: UIColor = FXColors.Blue50
var layerSuccess: UIColor = FXColors.Green80
var layerWarning: UIColor = FXColors.Yellow70.withAlphaComponent(0.77)
var layerError: UIColor = FXColors.Pink80
var layerCritical: UIColor = FXColors.Pink80
var layerSelectedText: UIColor = FXColors.Blue40
var layerAutofillText: UIColor = FXColors.Violet60
var layerSearch: UIColor = FXColors.Ink90
Expand Down Expand Up @@ -68,18 +68,18 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey90
var indicatorInactive: UIColor = FXColors.DarkGrey05
var actionConfirmation: UIColor = FXColors.Green70
var actionSuccess: UIColor = FXColors.Green70
var actionWarning: UIColor = FXColors.Yellow40.withAlphaComponent(0.41)
var actionError: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInfo: UIColor = FXColors.Blue60
var actionCritical: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInformation: UIColor = FXColors.Blue60
var actionTabActive: UIColor = FXColors.Purple60
var actionTabInactive: UIColor = FXColors.Ink90

// MARK: - Text
var textPrimary: UIColor = FXColors.LightGrey05
var textSecondary: UIColor = FXColors.LightGrey40
var textDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red20
var textCritical: UIColor = FXColors.Red20
var textAccent: UIColor = FXColors.Blue30
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -90,9 +90,9 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.LightGrey05
var iconSecondary: UIColor = FXColors.LightGrey40
var iconDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue30
var iconAccent: UIColor = FXColors.Blue30
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red20
var iconCritical: UIColor = FXColors.Red20
var iconSpinner: UIColor = FXColors.White
var iconAccentViolet: UIColor = FXColors.Violet20
var iconAccentBlue: UIColor = FXColors.Blue30
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/ThemeColourPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public protocol ThemeColourPalette {
var layerAccentPrivateNonOpaque: UIColor { get }
var layerSepia: UIColor { get }
var layerHomepage: Gradient { get }
var layerInfo: UIColor { get }
var layerConfirmation: UIColor { get }
var layerInformation: UIColor { get }
var layerSuccess: UIColor { get }
var layerWarning: UIColor { get }
var layerError: UIColor { get }
var layerCritical: UIColor { get }
var layerSelectedText: UIColor { get }
var layerAutofillText: UIColor { get }
var layerSearch: UIColor { get }
Expand Down Expand Up @@ -54,18 +54,18 @@ public protocol ThemeColourPalette {
var formKnob: UIColor { get }
var indicatorActive: UIColor { get }
var indicatorInactive: UIColor { get }
var actionConfirmation: UIColor { get }
var actionSuccess: UIColor { get }
var actionWarning: UIColor { get }
var actionError: UIColor { get }
var actionInfo: UIColor { get }
var actionCritical: UIColor { get }
var actionInformation: UIColor { get }
var actionTabActive: UIColor { get }
var actionTabInactive: UIColor { get }

// MARK: - Text
var textPrimary: UIColor { get }
var textSecondary: UIColor { get }
var textDisabled: UIColor { get }
var textWarning: UIColor { get }
var textCritical: UIColor { get }
var textAccent: UIColor { get }
var textOnDark: UIColor { get }
var textOnLight: UIColor { get }
Expand All @@ -76,9 +76,9 @@ public protocol ThemeColourPalette {
var iconPrimary: UIColor { get }
var iconSecondary: UIColor { get }
var iconDisabled: UIColor { get }
var iconAction: UIColor { get }
var iconAccent: UIColor { get }
var iconOnColor: UIColor { get }
var iconWarning: UIColor { get }
var iconCritical: UIColor { get }
var iconSpinner: UIColor { get }
var iconAccentViolet: UIColor { get }
var iconAccentBlue: UIColor { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public final class NavigationHeaderView: UIView {
.withTintColor(theme.colors.iconSecondary)
closeButton.setImage(buttonImage, for: .normal)
closeButton.backgroundColor = theme.colors.layer2
backButton.tintColor = theme.colors.iconAction
backButton.tintColor = theme.colors.iconAccent
backButton.setTitleColor(theme.colors.textAccent, for: .normal)
horizontalLine.backgroundColor = theme.colors.borderPrimary
titleLabel.textColor = theme.colors.textPrimary
Expand Down
2 changes: 1 addition & 1 deletion BrowserKit/Sources/ToolbarKit/ToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ToolbarButton: UIButton, ThemeApplicable {

badgeImageView?.layer.borderColor = colors.layer1.cgColor
badgeImageView?.backgroundColor = maskImageView == nil ? colors.layer1 : .clear
badgeImageView?.tintColor = maskImageView == nil ? .clear : colors.actionInfo
badgeImageView?.tintColor = maskImageView == nil ? .clear : colors.actionInformation
maskImageView?.tintColor = colors.layer1

setNeedsUpdateConfiguration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RemoveAddressButton: UIButton, ThemeApplicable {
func applyTheme(theme: any Theme) {
let color = theme.colors
backgroundColor = color.layer2
setTitleColor(color.textWarning, for: .normal)
setTitleColor(color.textCritical, for: .normal)
topSeparator.backgroundColor = color.borderPrimary
bottomSeparator.backgroundColor = color.borderPrimary
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct CreditCardInputField: View {

func applyTheme(theme: Theme) {
let color = theme.colors
errorColor = Color(color.textWarning)
errorColor = Color(color.textCritical)
titleColor = Color(color.textSecondary)
textFieldColor = Color(color.textPrimary)
backgroundColor = Color(color.layer2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct RemoveCardButton: View {
func applyTheme(theme: Theme) {
let color = theme.colors
backgroundColor = Color(color.layer2)
removeButtonColor = Color(color.textWarning)
removeButtonColor = Color(color.textCritical)
borderColor = Color(color.borderPrimary)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ class FakespotMessageCardViewModel: ObservableObject {

func primaryButtonBackground(theme: Theme) -> UIColor {
switch self {
case .confirmation: return theme.colors.actionConfirmation
case .confirmation: return theme.colors.actionSuccess
case .warning: return theme.colors.actionWarning
case .info: return theme.colors.actionInfo
case .info: return theme.colors.actionInformation
case .infoLoading: return theme.colors.actionSecondary
case .error: return theme.colors.actionError
case .error: return theme.colors.actionCritical
case .infoTransparent: return theme.colors.actionSecondary
}
}

func cardBackground(theme: Theme) -> UIColor {
switch self {
case .confirmation: return theme.colors.layerConfirmation
case .confirmation: return theme.colors.layerSuccess
case .warning: return theme.colors.layerWarning
case .info: return theme.colors.layerInfo
case .info: return theme.colors.layerInformation
case .infoLoading: return .clear
case .error: return theme.colors.layerError
case .error: return theme.colors.layerCritical
case .infoTransparent: return .clear
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class LegacyBookmarkDetailPanel: SiteTableViewController {
deleteBookmarkButton.titleLabel?.font = FXFontStyles.Regular.body.scaledFont()
deleteBookmarkButton.backgroundColor = currentTheme().colors.layer5
deleteBookmarkButton.setTitle(.Bookmarks.Menu.DeleteBookmark, for: .normal)
deleteBookmarkButton.setTitleColor(currentTheme().colors.textWarning, for: .normal)
deleteBookmarkButton.setTitleColor(currentTheme().colors.textCritical, for: .normal)
}

override func reloadData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ReadingListTableViewCell: UITableViewCell, ThemeApplicable {
selectedBackgroundView?.backgroundColor = theme.colors.layer5Hover
titleLabel.textColor = unread ? theme.colors.textPrimary : theme.colors.textDisabled
hostnameLabel.textColor = unread ? theme.colors.textPrimary : theme.colors.textDisabled
readStatusImageView.tintColor = theme.colors.iconAction
readStatusImageView.tintColor = theme.colors.iconAccent
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,18 @@ class BreachAlertsDetailView: UIView, ThemeApplicable {
let colors = theme.colors
layer.shadowColor = colors.shadowDefault.cgColor
backgroundColor = colors.layer2
titleIcon.tintColor = colors.iconWarning
titleLabel.textColor = colors.textWarning
breachDateLabel.textColor = colors.textWarning
descriptionLabel.textColor = colors.textWarning
titleIcon.tintColor = colors.iconCritical
titleLabel.textColor = colors.textCritical
breachDateLabel.textColor = colors.textCritical
descriptionLabel.textColor = colors.textCritical
goToLabel.attributedText = getAttributedText(
for: breachLink,
with: colors.textWarning
with: colors.textCritical
)
learnMoreButton.setAttributedTitle(
getAttributedText(
for: .BreachAlertsLearnMore,
with: colors.textWarning
with: colors.textCritical
),
for: .normal
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ class PasswordManagerTableViewCell: ThemedTableViewCell {
super.applyTheme(theme: theme)
hostnameLabel.textColor = theme.colors.textPrimary
usernameLabel.textColor = theme.colors.textSecondary
breachAlertImageView.tintColor = theme.colors.iconWarning
breachAlertImageView.tintColor = theme.colors.iconCritical
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class PasswordManagerListViewController: SensitiveViewController, Themeable {

selectionButton.setTitleColor(theme.colors.textInverted, for: [])
selectionButton.backgroundColor = theme.colors.actionPrimary
deleteButton.tintColor = theme.colors.textWarning
deleteButton.tintColor = theme.colors.textCritical

// Search bar text and placeholder color
let searchTextField = searchController.searchBar.searchTextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ClearPrivateDataTableViewController: ThemedTableViewController {

private var clearButtonEnabled = true {
didSet {
let textWarningColor = currentTheme().colors.textWarning
let textWarningColor = currentTheme().colors.textCritical
let textDisabledColor = currentTheme().colors.textDisabled
clearButton?.textLabel?.textColor = clearButtonEnabled ? textWarningColor : textDisabledColor
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class CustomSearchEngineTextView: Setting, UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
placeholderLabel.isHidden = !textField.text.isEmpty
settingDidChange?(textView.text)
let color = isValid(textField.text) ? theme.colors.textPrimary : theme.colors.textWarning
let color = isValid(textField.text) ? theme.colors.textPrimary : theme.colors.textCritical
textField.textColor = color
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AccountStatusSetting: WithAccountSetting {
override var status: NSAttributedString? {
if RustFirefoxAccounts.shared.isActionNeeded {
let string: String = .FxAAccountVerifyPassword
let color = theme.colors.textWarning
let color = theme.colors.textCritical
let range = NSRange(location: 0, length: string.count)
let attrs = [NSAttributedString.Key.foregroundColor: color]
let res = NSMutableAttributedString(string: string)
Expand Down
Loading

0 comments on commit 654ea9d

Please sign in to comment.