Skip to content

Commit

Permalink
Update web browser colors (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur authored Oct 24, 2023
1 parent ee076fb commit bc7de89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ class SettingsViewController: UITableViewController {
case Section.colorScheme:
let newColorScheme = colorScheme(at: indexPath)
ShopifyCheckout.configuration.colorScheme = newColorScheme
let navigationBarAppearance = newColorScheme.navigationBarAppearance
UINavigationBar.appearance().standardAppearance = navigationBarAppearance
UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance
navigationController?.navigationBar.standardAppearance = navigationBarAppearance
navigationController?.navigationBar.scrollEdgeAppearance = navigationBarAppearance
ShopifyCheckout.configuration.spinnerColor = newColorScheme.spinnerColor
view?.window?.overrideUserInterfaceStyle = newColorScheme.userInterfaceStyle
tableView.reloadSections(IndexSet(integer: Section.colorScheme.rawValue), with: .automatic)
default:
Expand Down Expand Up @@ -240,17 +236,12 @@ extension Configuration.ColorScheme {
}
}

var navigationBarAppearance: UINavigationBarAppearance {
switch self {
var spinnerColor: UIColor {
switch ShopifyCheckout.configuration.colorScheme {
case .web:
let navBarAppearance = UINavigationBarAppearance()
navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
navBarAppearance.backgroundColor = UIColor(red: 0.19, green: 0.05, blue: 0.48, alpha: 1.00)
return navBarAppearance
return UIColor(red: 0.18, green: 0.16, blue: 0.22, alpha: 1.00)
default:
let navBarAppearance = UINavigationBarAppearance()
navBarAppearance.configureWithDefaultBackground()
return navBarAppearance
return UIColor(red: 0.09, green: 0.45, blue: 0.69, alpha: 1.00)
}
}
}
14 changes: 3 additions & 11 deletions Sources/ShopifyCheckout/CheckoutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,9 @@ class CheckoutViewController: UIViewController, UIAdaptivePresentationController
private let checkoutURL: URL

private lazy var closeBarButtonItem: UIBarButtonItem = {
switch ShopifyCheckout.configuration.colorScheme {
case .web:
let closeIcon = UIImage(systemName: "xmark")?
.withConfiguration(UIImage.SymbolConfiguration(pointSize: 14, weight: .regular))
.withTintColor(.white, renderingMode: .alwaysOriginal)
return UIBarButtonItem(image: closeIcon, style: .plain, target: self, action: #selector(close))
default:
return UIBarButtonItem(
barButtonSystemItem: .close, target: self, action: #selector(close)
)
}
return UIBarButtonItem(
barButtonSystemItem: .close, target: self, action: #selector(close)
)
}()

// MARK: Initializers
Expand Down

0 comments on commit bc7de89

Please sign in to comment.