Skip to content

Commit 8a6e96b

Browse files
committed
Fix options screen for dark mode
1 parent 522acd7 commit 8a6e96b

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

WordPressEditor/WordPressEditor/Classes/ViewControllers/OptionsTableViewController/OptionsTableViewController.swift

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ public struct OptionsTableViewOption: Equatable {
2424
}
2525

2626
public class OptionsTableViewController: UITableViewController {
27+
28+
enum Constants {
29+
static var cellBackgroundColor: UIColor = {
30+
if #available(iOS 13.0, *) {
31+
return .systemBackground
32+
} else {
33+
return .white
34+
}
35+
}()
36+
37+
static var cellSelectedBackgroundColor: UIColor = {
38+
if #available(iOS 13.0, *) {
39+
return .secondarySystemBackground
40+
} else {
41+
return .lightGray
42+
}
43+
}()
44+
}
45+
2746
private static let rowHeight: CGFloat = 44.0
2847

2948
public typealias OnSelectHandler = (_ selected: Int) -> Void
@@ -32,14 +51,14 @@ public class OptionsTableViewController: UITableViewController {
3251

3352
public var onSelect: OnSelectHandler?
3453

35-
public var cellBackgroundColor: UIColor = .white {
54+
public var cellBackgroundColor: UIColor = Constants.cellBackgroundColor {
3655
didSet {
3756
tableView.backgroundColor = cellBackgroundColor
3857
tableView?.reloadData()
3958
}
4059
}
4160

42-
public var cellSelectedBackgroundColor: UIColor = .lightGray
61+
public var cellSelectedBackgroundColor: UIColor = Constants.cellSelectedBackgroundColor
4362

4463
public var cellDeselectedTintColor: UIColor? {
4564
didSet {

0 commit comments

Comments
 (0)