Adjust content gradient + settings

This commit is contained in:
Thomas Ricouard 2024-07-16 09:00:11 +02:00
parent 3c5c9adc03
commit fbff1d6dfe
4 changed files with 19 additions and 5 deletions

View file

@ -237,6 +237,7 @@ struct DisplaySettingsView: View {
}
}
Toggle("settings.display.show-account-popover", isOn: $userPreferences.showAccountPopover)
Toggle("Show Content Gradient", isOn: $theme.showContentGradient)
}
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor)

View file

@ -62126,6 +62126,9 @@
}
}
}
},
"Show Content Gradient" : {
},
"status.action.bookmark" : {
"extractionState" : "manual",

View file

@ -13,6 +13,7 @@ public final class Theme {
case displayFullUsernameTimeline
case lineSpacing
case statusActionSecondary
case contentGradient
}
@AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false
@ -30,6 +31,7 @@ public final class Theme {
@AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = false
@AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2
@AppStorage(ThemeKey.statusActionSecondary.rawValue) public var statusActionSecondary: StatusActionSecondary = .share
@AppStorage(ThemeKey.contentGradient.rawValue) public var showContentGradient: Bool = true
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
@AppStorage("chosen_font") public var chosenFontData: Data?
@ -283,6 +285,12 @@ public final class Theme {
}
}
public var showContentGradient: Bool {
didSet {
themeStorage.showContentGradient = showContentGradient
}
}
public var selectedSet: ColorSetName = .iceCubeDark
public static let shared = Theme()
@ -301,6 +309,7 @@ public final class Theme {
fontSizeScale = 1
chosenFontData = nil
statusActionSecondary = .share
showContentGradient = true
}
private init() {
@ -322,6 +331,7 @@ public final class Theme {
fontSizeScale = themeStorage.fontSizeScale
chosenFontData = themeStorage.chosenFontData
statusActionSecondary = themeStorage.statusActionSecondary
showContentGradient = themeStorage.showContentGradient
selectedSet = storedSet
computeContrastingTintColor()

View file

@ -108,7 +108,7 @@ import SwiftUI
@ViewBuilder
func makeBackgroundColor(isHomeTimeline: Bool) -> some View {
if isHomeTimeline {
if isHomeTimeline, theme.showContentGradient {
homeBackgroundColor
} else {
backgroundColor
@ -145,10 +145,10 @@ import SwiftUI
func makeDecorativeGradient(startColor: Color, endColor: Color) -> some View {
LinearGradient(stops: [
.init(color: startColor.opacity(0.3), location: 0.03),
.init(color: startColor.opacity(0.2), location: 0.06),
.init(color: startColor.opacity(0.1), location: 0.09),
.init(color: startColor.opacity(0.05), location: 0.15),
.init(color: startColor.opacity(0.2), location: 0.03),
.init(color: startColor.opacity(0.1), location: 0.06),
.init(color: startColor.opacity(0.05), location: 0.09),
.init(color: startColor.opacity(0.02), location: 0.15),
.init(color: endColor, location: 0.25),
],
startPoint: .topLeading,