Skip to content

Commit

Permalink
Apply Global colors to all views
Browse files Browse the repository at this point in the history
Global colors were not applied to all views and this PR fixes this issue

MOB-2679
  • Loading branch information
rasmustautsglia committed Oct 5, 2023
1 parent fc0e43e commit b252521
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 63 deletions.
4 changes: 1 addition & 3 deletions GliaWidgets/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ enum Color {
static let baseNormal = UIColor(hex: 0x6C7683) // grey
static let baseShade = UIColor(hex: 0x6C7683, alpha: 0.5)
static let baseDark = UIColor(hex: 0x2C0735) // purple
static let lightGrey = UIColor(hex: 0xF3F3F3) // light gray
static let grey = UIColor(hex: 0x999999) // gray
static let background: UIColor = .white
static let baseNeutral = UIColor(hex: 0xF3F3F3) // light gray
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension Theme {
borderColor: color.baseNormal,
borderWidth: 1,
cornerRadius: 4,
backgroundColor: color.background,
backgroundColor: color.baseLight,
accessibility: .init(isFontScalingEnabled: true)
)

Expand All @@ -68,7 +68,7 @@ extension Theme {
borderColor: color.primary,
borderWidth: 1,
cornerRadius: 4,
backgroundColor: color.background,
backgroundColor: color.baseLight,
accessibility: .init(isFontScalingEnabled: true)
)

Expand Down Expand Up @@ -178,7 +178,7 @@ extension Theme {
errorIcon: Asset.uploadError.image,
errorIconColor: color.systemNegative,
backgroundColor: color.primary,
errorBackgroundColor: Color.lightGrey,
errorBackgroundColor: color.baseNeutral,
accessibility: .init(isFontScalingEnabled: true)
)
let uploading = FileUploadStateStyle(
Expand Down Expand Up @@ -214,7 +214,7 @@ extension Theme {
error: error,
progressColor: color.primary,
errorProgressColor: color.systemNegative,
progressBackgroundColor: Color.lightGrey,
progressBackgroundColor: color.baseNeutral,
removeButtonImage: Asset.mcRemoveUpload.image,
removeButtonColor: color.baseNormal,
backgroundColor: .commonGray,
Expand Down Expand Up @@ -267,7 +267,7 @@ extension Theme {
return AttachmentSourceListStyle(
items: [pickPhoto, takePhoto, browse],
separatorColor: color.baseShade,
backgroundColor: Color.lightGrey
backgroundColor: color.baseNeutral
)
}

Expand All @@ -285,7 +285,7 @@ extension Theme {
filePickerButtonStyle: filePickerButtonStyle,
attachmentListStyle: uploadListStyle,
pickMediaStyle: pickMediaStyle,
backgroundColor: color.background
backgroundColor: color.baseLight
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extension RemoteConfiguration {
let baseLight: String?
let baseDark: String?
let baseShade: String?
let background: String?
let systemNegative: String?
let baseNeutral: String?
}
}

Expand Down
2 changes: 1 addition & 1 deletion GliaWidgets/Sources/Theme/Survey/Theme+Survey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extension Theme.SurveyStyle {

return .init(
layer: .init(
background: .fill(color: color.background),
background: .fill(color: color.baseLight),
borderColor: color.baseDark.cgColor,
cornerRadius: 30
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public extension Theme.SurveyStyle {
accessibility: .init(isFontScalingEnabled: true)
),
normalLayer: .init(
background: .fill(color: Color.baseLight),
background: .fill(color: color.baseLight),
borderColor: color.baseNormal.cgColor,
borderWidth: 1,
cornerRadius: 4
Expand Down
2 changes: 1 addition & 1 deletion GliaWidgets/Sources/Theme/Theme+Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension Theme {
titleImageColor: color.primary,
messageFont: font.bodyText,
messageColor: color.baseDark,
backgroundColor: .fill(color: color.background),
backgroundColor: .fill(color: color.baseLight),
closeButtonColor: .fill(color: color.baseNormal),
actionAxis: .horizontal,
positiveAction: positiveAction,
Expand Down
4 changes: 2 additions & 2 deletions GliaWidgets/Sources/Theme/Theme+AlertConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension Theme {
infoFont: font.subtitle,
infoColor: color.baseDark,
borderColor: color.primary,
backgroundColor: color.background,
backgroundColor: color.baseLight,
icon: Asset.upgradeAudio.image,
iconColor: color.primary
)
Expand All @@ -53,7 +53,7 @@ extension Theme {
infoFont: font.subtitle,
infoColor: color.baseDark,
borderColor: color.primary,
backgroundColor: color.background,
backgroundColor: color.baseLight,
icon: Asset.upgradePhone.image,
iconColor: color.primary
)
Expand Down
34 changes: 17 additions & 17 deletions GliaWidgets/Sources/Theme/Theme+Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ extension Theme {
accessibility: .init(isFontScalingEnabled: true)
)
let operatorImageFile = ChatImageFileContentStyle(
backgroundColor: Color.lightGrey,
backgroundColor: color.baseNeutral,
accessibility: .init(
contentAccessibilityLabel: Localization.Chat.Attachment.Message.Accessibility.label,
youAccessibilityPlaceholder: Localization.General.you,
Expand All @@ -196,7 +196,7 @@ extension Theme {
let operatorMessage = OperatorMessageStyle(
text: operatorText,
background: .init(
background: .fill(color: Color.lightGrey),
background: .fill(color: color.baseNeutral),
borderColor: .clear,
borderWidth: .zero,
cornerRadius: 8.49
Expand All @@ -219,7 +219,7 @@ extension Theme {
)
)
let choiceCardOptionNormalState = Button(
background: .fill(color: Color.lightGrey),
background: .fill(color: color.baseNeutral),
title: .init(
color: color.baseDark.hex,
font: font.bodyText,
Expand All @@ -233,7 +233,7 @@ extension Theme {
)
)
let choiceCardOptionSelectedState = Button(
background: .fill(color: Color.primary),
background: .fill(color: color.primary),
title: .init(
color: color.baseLight.hex,
font: font.bodyText,
Expand All @@ -247,16 +247,16 @@ extension Theme {
)
)
let choiceCardOptionDisabledState = Button(
background: .fill(color: Color.lightGrey),
background: .fill(color: color.baseNeutral),
title: .init(
color: Color.grey.hex,
color: color.baseShade.hex,
font: font.bodyText,
textStyle: .body,
accessibility: .init(isFontScalingEnabled: true)
),
cornerRadius: 4,
borderWidth: 1,
borderColor: Color.baseShade.toRGBAHex(),
borderColor: color.baseShade.toRGBAHex(),
accessibility: .init(
label: Localization.Chat.ChoiceCard.Button.Disabled.Accessibility.label,
isFontScalingEnabled: true
Expand Down Expand Up @@ -305,7 +305,7 @@ extension Theme {
placeholderFont: font.bodyText,
placeholderColor: color.baseNormal,
separatorColor: color.baseShade,
backgroundColor: color.background,
backgroundColor: color.baseLight,
mediaButton: mediaButton,
sendButton: sendButton,
uploadList: uploadListStyle,
Expand Down Expand Up @@ -372,14 +372,14 @@ extension Theme {
title: Localization.Chat.unreadMessageDivider,
titleColor: Color.baseNormal,
titleFont: font.buttonLabel,
lineColor: Color.primary,
lineColor: color.primary,
accessibility: .init(isFontScalingEnabled: true)
)

let systemMessage = SystemMessageStyle(
text: operatorText,
background: Theme.Layer(
background: .fill(color: Color.lightGrey),
background: .fill(color: color.baseNeutral),
borderColor: .clear,
borderWidth: .zero,
cornerRadius: 8.49
Expand All @@ -391,7 +391,7 @@ extension Theme {
return ChatStyle(
header: header,
connect: connect,
backgroundColor: .fill(color: color.background),
backgroundColor: .fill(color: color.baseLight),
preferredStatusBarStyle: .lightContent,
title: Localization.Engagement.Chat.title,
visitorMessageStyle: visitorMessage,
Expand Down Expand Up @@ -424,7 +424,7 @@ extension Theme {
errorIcon: Asset.uploadError.image,
errorIconColor: color.systemNegative,
backgroundColor: color.primary,
errorBackgroundColor: Color.lightGrey,
errorBackgroundColor: color.baseNeutral,
accessibility: .init(isFontScalingEnabled: true)
)
let uploading = FileUploadStateStyle(
Expand Down Expand Up @@ -460,7 +460,7 @@ extension Theme {
error: error,
progressColor: color.primary,
errorProgressColor: color.systemNegative,
progressBackgroundColor: Color.lightGrey,
progressBackgroundColor: color.baseNeutral,
removeButtonImage: Asset.uploadRemove.image,
removeButtonColor: color.baseNormal,
accessibility: .init(
Expand All @@ -481,7 +481,7 @@ extension Theme {
errorIcon: Asset.uploadError.image,
errorIconColor: color.systemNegative,
backgroundColor: color.primary,
errorBackgroundColor: Color.lightGrey,
errorBackgroundColor: color.baseNeutral,
accessibility: .init(isFontScalingEnabled: true)
)
let download = ChatFileDownloadStateStyle(
Expand Down Expand Up @@ -527,9 +527,9 @@ extension Theme {
error: error,
progressColor: color.primary,
errorProgressColor: color.systemNegative,
progressBackgroundColor: Color.lightGrey,
progressBackgroundColor: color.baseNeutral,
backgroundColor: .white,
borderColor: Color.lightGrey,
borderColor: color.baseNeutral,
accessibility: .init(
contentAccessibilityLabel: Localization.Chat.Attachment.Message.Accessibility.label,
youAccessibilityPlaceholder: Localization.General.you,
Expand Down Expand Up @@ -580,7 +580,7 @@ extension Theme {
return AttachmentSourceListStyle(
items: [pickPhoto, takePhoto, browse],
separatorColor: color.baseShade,
backgroundColor: Color.lightGrey
backgroundColor: color.baseNeutral
)
}
}
22 changes: 11 additions & 11 deletions GliaWidgets/Sources/Theme/Theme+Gva.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ extension Theme {
),
accessibility: .init(isFontScalingEnabled: true)
),
backgroundColor: .fill(color: color.lightGrey),
backgroundColor: .fill(color: color.baseNeutral),
cornerRadius: 10,
borderWidth: 0,
borderColor: .clear,
button: .init(
textFont: font.caption,
textColor: .black,
backgroundColor: .fill(color: color.background),
textColor: color.baseDark,
backgroundColor: .fill(color: color.baseLight),
cornerRadius: 5,
borderColor: .clear,
borderWidth: 0,
Expand All @@ -37,16 +37,16 @@ extension Theme {

let quickReplyButton: GvaQuickReplyButtonStyle = .init(
textFont: font.buttonLabel,
textColor: Color.primary,
backgroundColor: .fill(color: Color.baseLight),
textColor: color.primary,
backgroundColor: .fill(color: color.baseLight),
cornerRadius: 10,
borderColor: Color.primary,
borderColor: color.primary,
borderWidth: 1
)

let galleryCard: GvaGalleryCardStyle = .init(
cardContainer: .init(
backgroundColor: .fill(color: color.lightGrey),
backgroundColor: .fill(color: color.baseNeutral),
cornerRadius: 8,
borderColor: .clear,
borderWidth: 0
Expand All @@ -59,22 +59,22 @@ extension Theme {
),
title: .init(
font: font.mediumSubtitle1,
textColor: .black,
textColor: color.baseDark,
textStyle: .body
),
subtitle: .init(
font: font.caption,
textColor: .black,
textColor: color.baseDark,
textStyle: .caption1
),
button: .init(
title: .init(
font: font.caption,
textColor: .black,
textColor: color.baseDark,
textStyle: .caption1
),
background: .init(
backgroundColor: .fill(color: color.background),
backgroundColor: .fill(color: color.baseLight),
cornerRadius: 8,
borderColor: .clear,
borderWidth: 0
Expand Down
10 changes: 3 additions & 7 deletions GliaWidgets/Sources/Theme/Theme+VisitorCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import UIKit
extension Theme {
var visitorCodeStyle: VisitorCodeStyle {
let numberSlot = NumberSlotStyle(
backgroundColor: .fill(color: color.background),
borderColor: UIColor.ultraLightGray,
backgroundColor: .fill(color: color.baseLight),
borderColor: color.baseNeutral,
borderWidth: 1,
cornerRadius: 8,
numberFont: font.header1,
Expand All @@ -31,15 +31,11 @@ extension Theme {
poweredBy: poweredBy,
numberSlot: numberSlot,
actionButton: actionButton,
backgroundColor: .fill(color: color.background),
backgroundColor: .fill(color: color.baseLight),
cornerRadius: 30,
closeButtonColor: .fill(color: color.baseNormal),
loadingProgressColor: color.primary,
accessibility: .init(isFontScalingEnabled: true)
)
}
}

private extension UIColor {
static let ultraLightGray = UIColor(red: 0.953, green: 0.953, blue: 0.953, alpha: 1)
}
4 changes: 2 additions & 2 deletions GliaWidgets/Sources/Theme/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public class Theme {
baseLight: config.globalColors?.baseLight.map { UIColor(hex: $0) },
baseDark: config.globalColors?.baseDark.map { UIColor(hex: $0) },
baseShade: config.globalColors?.baseShade.map { UIColor(hex: $0) },
background: config.globalColors?.background.map { UIColor(hex: $0) },
systemNegative: config.globalColors?.systemNegative.map { UIColor(hex: $0) }
systemNegative: config.globalColors?.systemNegative.map { UIColor(hex: $0) },
baseNeutral: config.globalColors?.baseNeutral.map { UIColor(hex: $0) }
)
)
)
Expand Down
Loading

0 comments on commit b252521

Please sign in to comment.