Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
aed2f62918
commit
4bec90cc31
@ -121,12 +121,26 @@ struct CardTheme: Identifiable, Hashable, Sendable {
|
||||
|
||||
private var secondaryRGB: (Double, Double, Double) {
|
||||
if let rgb = customRGB {
|
||||
// Create a lighter/darker variant for gradient
|
||||
// Calculate luminance to determine if we should lighten or darken
|
||||
let luminance = 0.299 * rgb.0 + 0.587 * rgb.1 + 0.114 * rgb.2
|
||||
|
||||
if luminance < 0.3 {
|
||||
// Dark color: lighten uniformly to avoid color shifts
|
||||
let lightenAmount = 0.15
|
||||
return (
|
||||
min(1.0, rgb.0 + 0.2),
|
||||
min(1.0, rgb.1 + 0.15),
|
||||
min(1.0, rgb.2 + 0.1)
|
||||
min(1.0, rgb.0 + lightenAmount),
|
||||
min(1.0, rgb.1 + lightenAmount),
|
||||
min(1.0, rgb.2 + lightenAmount)
|
||||
)
|
||||
} else {
|
||||
// Light color: darken uniformly
|
||||
let darkenAmount = 0.12
|
||||
return (
|
||||
max(0.0, rgb.0 - darkenAmount),
|
||||
max(0.0, rgb.1 - darkenAmount),
|
||||
max(0.0, rgb.2 - darkenAmount)
|
||||
)
|
||||
}
|
||||
}
|
||||
guard let preset else { return (0.93, 0.83, 0.68) }
|
||||
switch preset {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user