Merge pull request #3154 from omnivore-app/fix/ios-dark-light-switch

Better light/dark mode switching on iOS
This commit is contained in:
Jackson Harper
2023-11-22 13:13:19 +08:00
committed by GitHub
6 changed files with 86 additions and 9 deletions

View File

@ -482,7 +482,7 @@ struct AnimatingCellHeight: AnimatableModifier {
}
}
}
.background(Color.isDarkMode ? Color(hex: "#1C1C1C") : Color.systemBackground)
.background(Color.themeFeatureBackground)
.frame(height: 190)
if !Color.isDarkMode {
@ -567,7 +567,7 @@ struct AnimatingCellHeight: AnimatableModifier {
featureCard
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
.listRowSeparator(.hidden, edges: .all)
.modifier(AnimatingCellHeight(height: 190 + (Color.isDarkMode ? 13 : 13)))
.modifier(AnimatingCellHeight(height: 190 + 13))
.onDisappear {
withAnimation {
isListScrolled = true

View File

@ -29,6 +29,8 @@ public extension Color {
static var themeLightestGray: Color { Color("_lightestGray", bundle: .module) }
static var themeDarkWhiteGray: Color { Color("_darkWhiteGray", bundle: .module) }
static var themeDarkGray: Color { Color("_darkGray", bundle: .module) }
static var themeLibraryItemSubtle: Color { Color("_themeLibraryItemSubtle", bundle: .module) }
static var themeFeatureBackground: Color { Color("_themeFeatureBackground", bundle: .module) }
static var themeLabelOutline: Color { Color("_labelOutline", bundle: .module) }
static var themeLabelForeground: Color { Color("_labelForeground", bundle: .module) }

View File

@ -2,7 +2,7 @@
"colors" : [
{
"color" : {
"color-space" : "srgb",
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0xD9",

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFE"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1C",
"green" : "0x1C",
"red" : "0x1C"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3C",
"green" : "0x3C",
"red" : "0x3C"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xD9",
"green" : "0xD9",
"red" : "0xD9"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -215,25 +215,24 @@ public struct LibraryItemCard: View {
$0.icon
}
let fgcolor = Color.isDarkMode ? Color.themeDarkWhiteGray : Color.themeMiddleGray
Text("\(estimatedReadingTime)")
.font(.caption2).fontWeight(.medium)
.foregroundColor(fgcolor)
.foregroundColor(Color.themeLibraryItemSubtle)
+
Text("\(readingProgress)")
.font(.caption2).fontWeight(.medium)
.foregroundColor(isPartiallyRead ? Color.appGreenSuccess : fgcolor)
.foregroundColor(isPartiallyRead ? Color.appGreenSuccess : Color.themeLibraryItemSubtle)
+
Text("\(highlightsText)")
.font(.caption2).fontWeight(.medium)
.foregroundColor(fgcolor)
.foregroundColor(Color.themeLibraryItemSubtle)
+
Text("\(notesText)")
.font(.caption2).fontWeight(.medium)
.foregroundColor(fgcolor)
.foregroundColor(Color.themeLibraryItemSubtle)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
@ -293,7 +292,7 @@ public struct LibraryItemCard: View {
var byLine: some View {
Text(bylineStr)
.font(.caption2)
.foregroundColor(Color.isDarkMode ? Color.themeDarkWhiteGray : Color.themeMiddleGray)
.foregroundColor(Color.themeLibraryItemSubtle)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(1)
}