Fix pattern wallpaper isDark detection

This commit is contained in:
Isaac
2025-12-30 22:25:20 +08:00
parent e4bb16bd53
commit 0b2f7bbe61

View File

@@ -1203,7 +1203,13 @@ public final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgrou
self.blurredBackgroundContents = nil
self.motionEnabled = false
self.wallpaperDisposable.set(nil)
self.updateIsDark(calculateWallpaperBrightness(from: gradientColors) <= 0.3)
if case let .file(file) = wallpaper, file.isPattern {
let intensity = CGFloat(file.settings.intensity ?? 50) / 100.0
self.updateIsDark(intensity < 0)
} else {
self.updateIsDark(calculateWallpaperBrightness(from: gradientColors) <= 0.3)
}
} else {
if let gradientBackgroundNode = self.gradientBackgroundNode {
self.gradientBackgroundNode = nil