macOS: match scroller’s appearance with surface’s background

pull/9619/head
Lukas 2025-11-17 09:21:30 +01:00
parent 711e10d930
commit 2f1427f529
No known key found for this signature in database
GPG Key ID: 845CB61BD38F4E49
1 changed files with 5 additions and 2 deletions

View File

@ -172,13 +172,16 @@ class SurfaceScrollView: NSView {
} }
// MARK: Scrolling // MARK: Scrolling
private func synchronizeAppearance() { private func synchronizeAppearance() {
let scrollbarConfig = surfaceView.derivedConfig.scrollbar let scrollbarConfig = surfaceView.derivedConfig.scrollbar
scrollView.hasVerticalScroller = scrollbarConfig != .never scrollView.hasVerticalScroller = scrollbarConfig != .never
scrollView.verticalScroller?.controlSize = .small scrollView.verticalScroller?.controlSize = .small
let hasLightBackground = OSColor(surfaceView.derivedConfig.backgroundColor).isLightColor
// Make sure the scrollers appearance matches the surface's background color.
scrollView.appearance = NSAppearance(named: hasLightBackground ? .aqua : .darkAqua)
} }
/// Positions the surface view to fill the currently visible rectangle. /// Positions the surface view to fill the currently visible rectangle.
/// ///
/// This is called whenever the scroll position changes. The surface view (which does the /// This is called whenever the scroll position changes. The surface view (which does the