Skip to content

Commit

Permalink
update theme to use system colours (#2180)
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy authored Nov 29, 2023
1 parent e01e9fb commit 59dbb74
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 187 deletions.
1 change: 0 additions & 1 deletion DuckDuckGo/AddressBarPositionSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class AddressBarPositionSettingsViewController: UITableViewController {
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)

cell.tintColor = theme.buttonTintColor
cell.textLabel?.textColor = theme.tableCellTextColor
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/AutoClearSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class AutoClearSettingsViewController: UITableViewController {

let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)

// Checkmark color
cell.tintColor = theme.buttonTintColor
Expand Down
4 changes: 1 addition & 3 deletions DuckDuckGo/AutocompleteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ extension AutocompleteViewController: UITableViewDataSource {

cell.backgroundColor = backgroundColor
cell.tintColor = currentTheme.autocompleteCellAccessoryColor
cell.setHighlightedStateBackgroundColor(currentTheme.tableCellHighlightedBackgroundColor)


return cell
}

Expand All @@ -255,7 +254,6 @@ extension AutocompleteViewController: UITableViewDataSource {

cell.tintColor = currentTheme.autocompleteCellAccessoryColor
cell.label?.textColor = currentTheme.tableCellTextColor
cell.setHighlightedStateBackgroundColor(currentTheme.tableCellHighlightedBackgroundColor)

return cell
}
Expand Down
15 changes: 15 additions & 0 deletions DuckDuckGo/AutofillLoginSettingsListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,21 @@ extension AutofillLoginSettingsListViewController: UITableViewDelegate {
return 0
}
}

func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection: Int) {
if let view = view as? UITableViewHeaderFooterView {
let theme = ThemeManager.shared.currentTheme
view.textLabel?.textColor = theme.tableHeaderTextColor
}
}

func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection: Int) {
if let view = view as? UITableViewHeaderFooterView {
let theme = ThemeManager.shared.currentTheme
view.textLabel?.textColor = theme.tableHeaderTextColor
}
}

}

// MARK: UITableViewDataSource
Expand Down
5 changes: 2 additions & 3 deletions DuckDuckGo/Base.lproj/Bookmarks.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,10 @@
<textInputTraits key="textInputTraits" returnKeyType="done"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fVp-1a-TkJ">
<rect key="frame" x="88" y="44" width="255" height="0.5"/>
<rect key="frame" x="88" y="44" width="255" height="0.0"/>
<color key="backgroundColor" name="BookmarksCellSeperatorColor"/>
<constraints>
<constraint firstAttribute="height" priority="750" constant="0.5" id="RDj-dx-Yf1"/>
<constraint firstAttribute="height" priority="750" constant="0.33000000000000002" id="RDj-dx-Yf1"/>
</constraints>
</view>
</subviews>
Expand All @@ -587,7 +587,6 @@
<color key="backgroundColor" name="surface"/>
<connections>
<outlet property="faviconImageView" destination="gf7-Lt-ftk" id="kIT-Vf-ZxY"/>
<outlet property="seperatorViewHeight" destination="RDj-dx-Yf1" id="f1A-nY-fdp"/>
<outlet property="titleTextField" destination="rT4-Yr-P8D" id="4f9-bl-KM7"/>
<outlet property="urlTextField" destination="YqY-sP-hhb" id="b8Y-vb-Msu"/>
</connections>
Expand Down
15 changes: 11 additions & 4 deletions DuckDuckGo/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9SF-AN-ir1">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9SF-AN-ir1">
<device id="retina6_5" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -25,11 +26,11 @@
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="TextDuckDuckGo" translatesAutoresizingMaskIntoConstraints="NO" id="CCq-t1-1xH">
<rect key="frame" x="126" y="436" width="162" height="21"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="textPrimary"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Uoe-RS-vTk"/>
<color key="backgroundColor" red="0.13333333333333333" green="0.13333333333333333" blue="0.13333333333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="background"/>
<constraints>
<constraint firstItem="EId-hf-6HL" firstAttribute="centerX" secondItem="5uF-ws-lnA" secondAttribute="centerX" id="2In-4c-xKC"/>
<constraint firstItem="CCq-t1-1xH" firstAttribute="centerX" secondItem="5uF-ws-lnA" secondAttribute="centerX" id="VEh-23-FIM"/>
Expand All @@ -47,5 +48,11 @@
<resources>
<image name="Logo" width="128" height="128"/>
<image name="TextDuckDuckGo" width="162" height="21"/>
<namedColor name="background">
<color red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textPrimary">
<color red="0.0" green="0.0" blue="0.0" alpha="0.8399999737739563" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
2 changes: 0 additions & 2 deletions DuckDuckGo/BookmarkDetailsCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ class BookmarkDetailsCell: UITableViewCell {
@IBOutlet weak var titleTextField: UITextField!
@IBOutlet weak var urlTextField: UITextField!
@IBOutlet weak var faviconImageView: UIImageView!
@IBOutlet weak var seperatorViewHeight: NSLayoutConstraint!

func setUp() {
selectionStyle = .none

seperatorViewHeight.constant = 1.0 / UIScreen.main.scale
titleTextField.becomeFirstResponder()

titleTextField.removeTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
Expand Down
2 changes: 0 additions & 2 deletions DuckDuckGo/BookmarksViewControllerCells.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class BookmarksViewControllerCellFactory {
let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.titleLabel.textColor = theme.tableCellTextColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)
cell.favoriteImageView.tintColor = UIColor(designSystemColor: .icons)
cell.editingAccessoryType = .disclosureIndicator
return cell
Expand All @@ -91,7 +90,6 @@ class BookmarksViewControllerCellFactory {
cell.backgroundColor = theme.tableCellBackgroundColor
cell.titleLabel.textColor = theme.tableCellTextColor
cell.childrenCountLabel.textColor = theme.tableCellTextColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)
cell.editingAccessoryType = .disclosureIndicator
return cell
}
Expand Down
71 changes: 6 additions & 65 deletions DuckDuckGo/DarkTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,93 +32,34 @@ struct DarkTheme: Theme {
var tabsBarBackgroundColor = UIColor.black
var tabsBarSeparatorColor = UIColor.darkGreyish

var navigationBarTitleColor = UIColor.white
var navigationBarTintColor = UIColor.lightMercury

var tintOnBlurColor = UIColor.white

var searchBarBackgroundColor = UIColor.charcoalGrey

var centeredSearchBarBackgroundColor = UIColor.nearlyBlackLight
var searchBarTextColor = UIColor.white
var searchBarTextDeemphasisColor = UIColor.lightMercury
var searchBarBorderColor = UIColor.darkGreyish
var searchBarClearTextIconColor = UIColor.greyish2
var searchBarVoiceSearchIconColor = UIColor.greyish2

var browsingMenuTextColor = UIColor.white
var browsingMenuIconsColor = UIColor.gray20
var browsingMenuSeparatorColor = UIColor.charcoalGrey
var browsingMenuHighlightColor = UIColor.darkGreyish

var progressBarGradientDarkColor = UIColor.orange
var progressBarGradientLightColor = UIColor.orangeLight

var autocompleteSuggestionTextColor = UIColor.white
var autocompleteCellAccessoryColor = UIColor.lightMercury

var browsingMenuHighlightColor = UIColor.darkGreyish

var tableCellSelectedColor = UIColor.charcoalGrey
var tableCellSeparatorColor = UIColor.charcoalGrey
var tableCellTextColor = UIColor.lightGreyish
var tableCellAccessoryTextColor = UIColor.greyish
var tableCellAccessoryColor = UIColor.greyish3
var tableCellHighlightedBackgroundColor = UIColor.greyishBrown
var tableHeaderTextColor = UIColor.greyish3

var tabSwitcherCellBorderColor = UIColor.white
var tabSwitcherCellTextColor = UIColor.white
var tabSwitcherCellSecondaryTextColor = UIColor.lightMercury

var iconCellBorderColor = UIColor.lightGreyish

var buttonTintColor = UIColor.cornflowerBlue
var placeholderColor = UIColor.greyish

var textFieldBackgroundColor = UIColor.nearlyBlackLight
var textFieldFontColor = UIColor.white


var homeRowPrimaryTextColor = UIColor.white
var homeRowSecondaryTextColor = UIColor.lightMercury
var homeRowBackgroundColor = UIColor.nearlyBlackLight

var homePrivacyCellTextColor = UIColor.white
var homePrivacyCellSecondaryTextColor = UIColor.greyish3

var aboutScreenTextColor = UIColor.white
var aboutScreenButtonColor = UIColor.cornflowerBlue


var favoritesPlusTintColor = UIColor.greyish3
var favoritesPlusBackgroundColor = UIColor.greyishBrown2

var faviconBackgroundColor = UIColor.charcoalGrey
var favoriteTextColor = UIColor.greyish

var feedbackPrimaryTextColor = UIColor.white
var feedbackSecondaryTextColor = UIColor.lightGreyish
var feedbackSentimentButtonBackgroundColor = UIColor.charcoalGrey

var privacyReportCellBackgroundColor = UIColor.nearlyBlackLight

var activityStyle: UIActivityIndicatorView.Style = .medium

var destructiveColor: UIColor = UIColor.destructive

var ddgTextTintColor: UIColor = .white

var daxDialogBackgroundColor: UIColor = .nearlyBlackLight
var daxDialogTextColor: UIColor = UIColor.nearlyWhite

var homeMessageBackgroundColor = UIColor.nearlyBlackLight
var homeMessageHeaderTextColor = UIColor.white
var homeMessageSubheaderTextColor = UIColor.greyish2
var homeMessageTopTextColor = UIColor.cornflowerBlue
var homeMessageButtonColor = UIColor.cornflowerBlue
var homeMessageButtonTextColor = UIColor.white
var homeMessageDismissButtonColor = UIColor.white

var autofillDefaultTitleTextColor = UIColor.white
var autofillDefaultSubtitleTextColor = UIColor.lightMercury
var autofillEmptySearchViewTextColor = UIColor.gray20
var autofillLockedViewTextColor = UIColor.lightMercury

var privacyDashboardWebviewBackgroundColor = UIColor.nearlyBlackLight
var searchBarBackgroundColor: UIColor = UIColor.charcoalGrey
}
1 change: 0 additions & 1 deletion DuckDuckGo/FeedbackPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class FeedbackPickerViewController: UITableViewController {
let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.textLabel?.textColor = theme.tableCellTextColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)

let text = cell.textLabel?.attributedText?.mutableCopy() as? NSMutableAttributedString
text?.mutableString.setString(entries[indexPath.row].userText)
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/FireButtonAnimationSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class FireButtonAnimationSettingsViewController: UITableViewController {

let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)

// Checkmark color
cell.tintColor = theme.buttonTintColor
Expand Down
69 changes: 4 additions & 65 deletions DuckDuckGo/LightTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,94 +33,33 @@ struct LightTheme: Theme {
var tabsBarBackgroundColor = UIColor.gray20
var tabsBarSeparatorColor = UIColor.greyish


var navigationBarTitleColor = UIColor.nearlyBlackLight
var navigationBarTintColor = UIColor.darkGreyish

var tintOnBlurColor = UIColor.white

var searchBarBackgroundColor = UIColor.lightGreyish
var centeredSearchBarBackgroundColor = UIColor.mercury
var searchBarTextColor = UIColor.nearlyBlackLight
var searchBarTextDeemphasisColor = UIColor.greyish3
var searchBarBorderColor = UIColor.lightGreyish
var searchBarClearTextIconColor = UIColor.greyish2
var searchBarVoiceSearchIconColor = UIColor.greyish2

var browsingMenuTextColor = UIColor.nearlyBlack
var browsingMenuIconsColor = UIColor.nearlyBlackLight
var browsingMenuSeparatorColor = UIColor.mercury
var browsingMenuHighlightColor = UIColor.lightGreyish

var progressBarGradientDarkColor = UIColor.cornflowerBlue
var progressBarGradientLightColor = UIColor.skyBlueLight

var autocompleteSuggestionTextColor = UIColor.black
var autocompleteCellAccessoryColor = UIColor.darkGreyish
var browsingMenuHighlightColor = UIColor.lightGreyish

var tableCellSelectedColor = UIColor.mercury
var tableCellSeparatorColor = UIColor(white: 0, alpha: 0.09)
var tableCellTextColor = UIColor.darkGreyish
var tableCellAccessoryTextColor = UIColor.greyish3
var tableCellAccessoryColor = UIColor.greyish
var tableCellHighlightedBackgroundColor = UIColor.mercury
var tableHeaderTextColor = UIColor.greyish3

var tabSwitcherCellBorderColor = UIColor.nearlyBlackLight
var tabSwitcherCellTextColor = UIColor.black
var tabSwitcherCellSecondaryTextColor = UIColor.greyishBrown2

var iconCellBorderColor = UIColor.darkGreyish

var buttonTintColor = UIColor.cornflowerBlue
var placeholderColor = UIColor.greyish3

var textFieldBackgroundColor = UIColor.white
var textFieldFontColor = UIColor.nearlyBlackLight

var homeRowPrimaryTextColor = UIColor.nearlyBlackLight
var homeRowSecondaryTextColor = UIColor.greyishBrown2
var homeRowBackgroundColor = UIColor.nearlyWhiteLight

var homePrivacyCellTextColor = UIColor.charcoalGrey
var homePrivacyCellSecondaryTextColor = UIColor.greyish3

var aboutScreenTextColor = UIColor.charcoalGrey
var aboutScreenButtonColor = UIColor.cornflowerBlue


var favoritesPlusTintColor = UIColor.greyish3
var favoritesPlusBackgroundColor = UIColor.lightMercury

var faviconBackgroundColor = UIColor.white
var favoriteTextColor = UIColor.darkGreyish

var feedbackPrimaryTextColor = UIColor.nearlyBlackLight
var feedbackSecondaryTextColor = UIColor.nearlyBlackLight
var feedbackSentimentButtonBackgroundColor = UIColor.white

var privacyReportCellBackgroundColor = UIColor.white


var activityStyle: UIActivityIndicatorView.Style = .medium

var destructiveColor: UIColor = UIColor.destructive

var ddgTextTintColor: UIColor = UIColor.nearlyBlackLight

var daxDialogBackgroundColor: UIColor = UIColor.white
var daxDialogTextColor: UIColor = UIColor.darkGreyish

var homeMessageBackgroundColor = UIColor.white
var homeMessageHeaderTextColor = UIColor.black
var homeMessageSubheaderTextColor = UIColor.greyish3
var homeMessageTopTextColor = UIColor.cornflowerBlue
var homeMessageButtonColor = UIColor.cornflowerBlue
var homeMessageButtonTextColor = UIColor.white
var homeMessageDismissButtonColor = UIColor.nearlyBlackLight

var autofillDefaultTitleTextColor = UIColor.nearlyBlack
var autofillDefaultSubtitleTextColor = UIColor.greyishBrown2
var autofillEmptySearchViewTextColor = UIColor.gray50
var autofillLockedViewTextColor = UIColor.nearlyBlack

var privacyDashboardWebviewBackgroundColor = UIColor.white
var searchBarBackgroundColor: UIColor = UIColor.lightGreyish
}
9 changes: 0 additions & 9 deletions DuckDuckGo/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,8 @@ class SettingsViewController: UITableViewController {
}

override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)

if cell.accessoryType == .disclosureIndicator {
let accesoryImage = UIImageView(image: UIImage(named: "DisclosureIndicator"))
accesoryImage.frame = CGRect(x: 0, y: 0, width: 8, height: 13)
accesoryImage.tintColor = theme.tableCellAccessoryColor
cell.accessoryView = accesoryImage
}
}

override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection: Int) {
Expand Down
Loading

0 comments on commit 59dbb74

Please sign in to comment.