Skip to content

Commit

Permalink
Update Ice Bar color algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbaird committed Jul 4, 2024
1 parent 563a86b commit 8a86ce2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Ice/IceBar/IceBarColorManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ class IceBarColorManager: ObservableObject {
return
}

let percentage = (frame.midX - screen.frame.origin.x) / screen.frame.width
let percentage = ((frame.midX - screen.frame.origin.x) / screen.frame.width).clamped(to: 0...1)
let bounds = CGRect(
x: frame.origin.x + (frame.width * percentage),
y: 0,
width: 0,
height: 1
).insetBy(dx: -50, dy: 0)
).insetBy(dx: -10, dy: 0)
print(bounds.minX, bounds.maxX)

guard
let croppedImage = windowImage.cropping(to: bounds),
let averageColor = croppedImage.averageColor(resolution: .low)
else {
colorInfo = nil
return
}

Expand Down

0 comments on commit 8a86ce2

Please sign in to comment.