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

Color cleanup #4476

Merged
merged 7 commits into from
Mar 6, 2023
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
67 changes: 58 additions & 9 deletions WMF Framework/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public extension UIColor {
// Wikimedia Style Guide Colors
// https://design.wikimedia.org/style-guide/visual-style_colors.html

static let base0 = UIColor(0x000000)
@objc static let base0 = UIColor(0x000000)
static let base10 = UIColor(0x202122)
static let base20 = UIColor(0x54595D)
static let base30 = UIColor(0x72777D) // formerly battleship grey
Expand Down Expand Up @@ -110,7 +110,42 @@ public extension UIColor {

static let accent50At10PercentAlpha = accent50.withAlphaComponent(0.1)
static let accent50At25PercentAlpha = accent50.withAlphaComponent(0.25)


// talk page colors
static let talkPageBackgroundLight = UIColor(0xF8F9FA)
static let talkPageBackgroundSepia = UIColor(0xF0E6D6)
static let talkPageBackgroundDark = UIColor(0x202122)
static let talkPageBackgroundBlack = UIColor(0x202122)

static let talkPageCoffeeRollLight = UIColor(0xF8F1E3)
static let talkPageCoffeRollSepia = UIColor(0xE1DAD1)
static let talkPageCoffeRollDark = UIColor(0x101418)
static let talkPageCoffeRollBlack = UIColor(0x101418)

// settings colors
@objc static let settingsOrange = UIColor(0xFF8E2B)
@objc static let settingsOrange2 = UIColor(0xFEA13D)
@objc static let settingsGrey = UIColor(0x9AA0A7)
@objc static let settingsGrey2 = UIColor(0x99A1A7)
@objc static let settingsRed = UIColor(0xFF1B33)
@objc static let settingsBlueLight = UIColor(0x5ac8fa)
@objc static let settingsBlue = UIColor(0x1F95DE)
@objc static let settingsBlue2 = UIColor(0x00b4ce)
@objc static let settingsDarkBlue = UIColor(0x1F45DE)
@objc static let settingsPurple = UIColor(0x884FDC)
@objc static let settingsGreen = UIColor(0x95D15A)
@objc static let settingsYellow = UIColor(0xFFBF02)

@objc static let eraseArticleIconRed = UIColor(0xC52C2D)
@objc static let expandTableIconBlue = UIColor(0x5C97BF)

// third-party slider
@objc static let sliderGrey = UIColor(0x989898)
@objc static let sliderLightGrey = UIColor(0xDEDEDE)

// widget
@objc static let widgetBlue = UIColor(0x318CDB)

@objc func wmf_hexStringIncludingAlpha(_ includeAlpha: Bool) -> String {
var r: CGFloat = 0
var g: CGFloat = 0
Expand Down Expand Up @@ -198,7 +233,9 @@ public class Colors: NSObject {
diffContextItemBorder: .darkBase90,
diffMoveParagraphBackground: .lightBorder,
diffCompareAccent: .orange50,
diffCompareChangeHeading: .base100)
diffCompareChangeHeading: .base100,
talkPageBackground: .talkPageBackgroundLight,
talkPageCoffeRollBackground: .talkPageCoffeeRollLight)

fileprivate static let sepia = Colors(
baseBackground: .sepiaBase85,
Expand Down Expand Up @@ -265,7 +302,9 @@ public class Colors: NSObject {
diffContextItemBorder: .sepiaBorder,
diffMoveParagraphBackground: .sepiaBase90,
diffCompareAccent: .orange50,
diffCompareChangeHeading: .base100)
diffCompareChangeHeading: .base100,
talkPageBackground: .talkPageBackgroundSepia,
talkPageCoffeRollBackground: .talkPageCoffeRollSepia)

fileprivate static let dark = Colors(
baseBackground: .base10,
Expand Down Expand Up @@ -332,7 +371,9 @@ public class Colors: NSObject {
diffContextItemBorder: .darkBase10,
diffMoveParagraphBackground: .darkBase30,
diffCompareAccent: .orange50,
diffCompareChangeHeading: .base0)
diffCompareChangeHeading: .base0,
talkPageBackground: .talkPageBackgroundDark,
talkPageCoffeRollBackground: .talkPageCoffeRollDark)

fileprivate static let black = Colors(
baseBackground: .darkBase05,
Expand Down Expand Up @@ -399,7 +440,9 @@ public class Colors: NSObject {
diffContextItemBorder: .base10,
diffMoveParagraphBackground: .darkBase20,
diffCompareAccent: .orange50,
diffCompareChangeHeading: .base0)
diffCompareChangeHeading: .base0,
talkPageBackground: .talkPageBackgroundBlack,
talkPageCoffeRollBackground: .talkPageCoffeRollBlack)

fileprivate static let widgetLight = Colors(
baseBackground: .clear,
Expand Down Expand Up @@ -457,7 +500,7 @@ public class Colors: NSObject {
pageIndicatorCurrent: .accent30,
unreadIndicator: .green50,
depthMarker: .base20)

fileprivate static let widgetDark = Colors(
baseBackground: .clear,
midBackground: .clear,
Expand Down Expand Up @@ -514,7 +557,7 @@ public class Colors: NSObject {
pageIndicatorCurrent: .accent70,
unreadIndicator: .green50,
depthMarker: .base70)

@objc public let baseBackground: UIColor
@objc public let midBackground: UIColor
@objc public let subCellBackground: UIColor
Expand Down Expand Up @@ -608,9 +651,13 @@ public class Colors: NSObject {
public let diffMoveParagraphBackground: UIColor
public let diffCompareAccent: UIColor
public let diffCompareChangeHeading: UIColor

public let talkPageBackground: UIColor
public let talkPageCoffeRollBackground: UIColor


// Someday, when the app is all swift, make this class a struct.
init(baseBackground: UIColor, midBackground: UIColor, paperBackground: UIColor, chromeBackground: UIColor, popoverBackground: UIColor, subCellBackground: UIColor, overlayBackground: UIColor, batchSelectionBackground: UIColor, referenceHighlightBackground: UIColor, hintBackground: UIColor, hintWarningBackground: UIColor, animationBackground: UIColor, overlayText: UIColor, searchFieldBackground: UIColor, keyboardBarSearchFieldBackground: UIColor, primaryText: UIColor, secondaryText: UIColor, tertiaryText: UIColor, disabledText: UIColor, disabledLink: UIColor, chromeText: UIColor, link: UIColor, accent: UIColor, border: UIColor, shadow: UIColor, chromeShadow: UIColor, cardBackground: UIColor, selectedCardBackground: UIColor, cardBorder: UIColor, cardShadow: UIColor, cardButtonBackground: UIColor, cardButtonSelectedBackground: UIColor, secondaryAction: UIColor, icon: UIColor?, iconBackground: UIColor?, destructive: UIColor, error: UIColor, warning: UIColor, unselected: UIColor, blurEffectStyle: UIBlurEffect.Style, blurEffectBackground: UIColor, tagText: UIColor, tagBackground: UIColor, tagSelectedBackground: UIColor, rankGradientStart: UIColor, rankGradientEnd: UIColor, distanceBorder: UIColor, descriptionBackground: UIColor, descriptionWarning: UIColor, inputAccessoryBackground: UIColor, inputAccessoryButtonTint: UIColor, pageIndicator: UIColor, pageIndicatorCurrent: UIColor, unreadIndicator: UIColor, depthMarker: UIColor, diffTextAdd: UIColor = .base10, diffTextDelete: UIColor = .base10, diffHighlightAdd: UIColor? = .green90, diffHighlightDelete: UIColor? = .red90, diffStrikethroughColor: UIColor = .base0, diffContextItemBackground: UIColor = .base90, diffContextItemBorder: UIColor = .darkBase90, diffMoveParagraphBackground: UIColor = .base90, diffCompareAccent: UIColor = .orange50, diffCompareChangeHeading: UIColor = .base100) {
init(baseBackground: UIColor, midBackground: UIColor, paperBackground: UIColor, chromeBackground: UIColor, popoverBackground: UIColor, subCellBackground: UIColor, overlayBackground: UIColor, batchSelectionBackground: UIColor, referenceHighlightBackground: UIColor, hintBackground: UIColor, hintWarningBackground: UIColor, animationBackground: UIColor, overlayText: UIColor, searchFieldBackground: UIColor, keyboardBarSearchFieldBackground: UIColor, primaryText: UIColor, secondaryText: UIColor, tertiaryText: UIColor, disabledText: UIColor, disabledLink: UIColor, chromeText: UIColor, link: UIColor, accent: UIColor, border: UIColor, shadow: UIColor, chromeShadow: UIColor, cardBackground: UIColor, selectedCardBackground: UIColor, cardBorder: UIColor, cardShadow: UIColor, cardButtonBackground: UIColor, cardButtonSelectedBackground: UIColor, secondaryAction: UIColor, icon: UIColor?, iconBackground: UIColor?, destructive: UIColor, error: UIColor, warning: UIColor, unselected: UIColor, blurEffectStyle: UIBlurEffect.Style, blurEffectBackground: UIColor, tagText: UIColor, tagBackground: UIColor, tagSelectedBackground: UIColor, rankGradientStart: UIColor, rankGradientEnd: UIColor, distanceBorder: UIColor, descriptionBackground: UIColor, descriptionWarning: UIColor, inputAccessoryBackground: UIColor, inputAccessoryButtonTint: UIColor, pageIndicator: UIColor, pageIndicatorCurrent: UIColor, unreadIndicator: UIColor, depthMarker: UIColor, diffTextAdd: UIColor = .base10, diffTextDelete: UIColor = .base10, diffHighlightAdd: UIColor? = .green90, diffHighlightDelete: UIColor? = .red90, diffStrikethroughColor: UIColor = .base0, diffContextItemBackground: UIColor = .base90, diffContextItemBorder: UIColor = .darkBase90, diffMoveParagraphBackground: UIColor = .base90, diffCompareAccent: UIColor = .orange50, diffCompareChangeHeading: UIColor = .base100, talkPageBackground: UIColor = .talkPageBackgroundLight, talkPageCoffeRollBackground: UIColor = .talkPageCoffeeRollLight) {
self.baseBackground = baseBackground
self.midBackground = midBackground
self.subCellBackground = subCellBackground
Expand Down Expand Up @@ -693,6 +740,8 @@ public class Colors: NSObject {
self.diffMoveParagraphBackground = diffMoveParagraphBackground
self.diffCompareAccent = diffCompareAccent
self.diffCompareChangeHeading = diffCompareChangeHeading
self.talkPageBackground = talkPageBackground
self.talkPageCoffeRollBackground = talkPageCoffeRollBackground
}
}

Expand Down
2 changes: 1 addition & 1 deletion Widgets/Widgets/FeaturedArticleWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct FeaturedArticleView: View {
} else {
ZStack {
Rectangle()
.foregroundColor(Color(UIColor("318CDB")))
.foregroundColor(Color(UIColor.widgetBlue))
Text(entry.extract)
.font(.headline)
.fontWeight(.semibold)
Expand Down
Loading