Skip to content

Commit 8f0f090

Browse files
authored
Merge pull request #3154 from omnivore-app/fix/ios-dark-light-switch
Better light/dark mode switching on iOS
2 parents 8259eed + b022cd7 commit 8f0f090

File tree

6 files changed

+86
-9
lines changed

6 files changed

+86
-9
lines changed

apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ struct AnimatingCellHeight: AnimatableModifier {
482482
}
483483
}
484484
}
485-
.background(Color.isDarkMode ? Color(hex: "#1C1C1C") : Color.systemBackground)
485+
.background(Color.themeFeatureBackground)
486486
.frame(height: 190)
487487

488488
if !Color.isDarkMode {
@@ -567,7 +567,7 @@ struct AnimatingCellHeight: AnimatableModifier {
567567
featureCard
568568
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
569569
.listRowSeparator(.hidden, edges: .all)
570-
.modifier(AnimatingCellHeight(height: 190 + (Color.isDarkMode ? 13 : 13)))
570+
.modifier(AnimatingCellHeight(height: 190 + 13))
571571
.onDisappear {
572572
withAnimation {
573573
isListScrolled = true

apple/OmnivoreKit/Sources/Views/Colors/Colors.swift

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public extension Color {
2929
static var themeLightestGray: Color { Color("_lightestGray", bundle: .module) }
3030
static var themeDarkWhiteGray: Color { Color("_darkWhiteGray", bundle: .module) }
3131
static var themeDarkGray: Color { Color("_darkGray", bundle: .module) }
32+
static var themeLibraryItemSubtle: Color { Color("_themeLibraryItemSubtle", bundle: .module) }
33+
static var themeFeatureBackground: Color { Color("_themeFeatureBackground", bundle: .module) }
3234

3335
static var themeLabelOutline: Color { Color("_labelOutline", bundle: .module) }
3436
static var themeLabelForeground: Color { Color("_labelForeground", bundle: .module) }

apple/OmnivoreKit/Sources/Views/Colors/ThemeColors.xcassets/_darkWhiteGray.colorset/Contents.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"colors" : [
33
{
44
"color" : {
5-
"color-space" : "srgb",
5+
"color-space" : "display-p3",
66
"components" : {
77
"alpha" : "1.000",
88
"blue" : "0xD9",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0xFF",
9+
"green" : "0xFF",
10+
"red" : "0xFE"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "0x1C",
27+
"green" : "0x1C",
28+
"red" : "0x1C"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0x3C",
9+
"green" : "0x3C",
10+
"red" : "0x3C"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "0xD9",
27+
"green" : "0xD9",
28+
"red" : "0xD9"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}

apple/OmnivoreKit/Sources/Views/FeedItem/LibraryItemCard.swift

+5-6
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,24 @@ public struct LibraryItemCard: View {
215215
$0.icon
216216
}
217217

218-
let fgcolor = Color.isDarkMode ? Color.themeDarkWhiteGray : Color.themeMiddleGray
219218
Text("\(estimatedReadingTime)")
220219
.font(.caption2).fontWeight(.medium)
221-
.foregroundColor(fgcolor)
220+
.foregroundColor(Color.themeLibraryItemSubtle)
222221

223222
+
224223
Text("\(readingProgress)")
225224
.font(.caption2).fontWeight(.medium)
226-
.foregroundColor(isPartiallyRead ? Color.appGreenSuccess : fgcolor)
225+
.foregroundColor(isPartiallyRead ? Color.appGreenSuccess : Color.themeLibraryItemSubtle)
227226

228227
+
229228
Text("\(highlightsText)")
230229
.font(.caption2).fontWeight(.medium)
231-
.foregroundColor(fgcolor)
230+
.foregroundColor(Color.themeLibraryItemSubtle)
232231

233232
+
234233
Text("\(notesText)")
235234
.font(.caption2).fontWeight(.medium)
236-
.foregroundColor(fgcolor)
235+
.foregroundColor(Color.themeLibraryItemSubtle)
237236
}
238237
.frame(maxWidth: .infinity, alignment: .leading)
239238
}
@@ -293,7 +292,7 @@ public struct LibraryItemCard: View {
293292
var byLine: some View {
294293
Text(bylineStr)
295294
.font(.caption2)
296-
.foregroundColor(Color.isDarkMode ? Color.themeDarkWhiteGray : Color.themeMiddleGray)
295+
.foregroundColor(Color.themeLibraryItemSubtle)
297296
.frame(maxWidth: .infinity, alignment: .leading)
298297
.lineLimit(1)
299298
}

0 commit comments

Comments
 (0)