style: add sunset palette and soft background glows
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import AppKit
|
||||
|
||||
@MainActor
|
||||
enum SunsetPalette {
|
||||
static let background = NSColor(srgbRed: 0.12, green: 0.09, blue: 0.08, alpha: 0.96)
|
||||
static let text = NSColor(srgbRed: 1.00, green: 0.89, blue: 0.71, alpha: 1)
|
||||
static let secondaryText = NSColor(srgbRed: 0.85, green: 0.78, blue: 0.65, alpha: 1)
|
||||
static let accent = NSColor(srgbRed: 0.95, green: 0.58, blue: 0.23, alpha: 1)
|
||||
static let selectionFill = accent.withAlphaComponent(0.12)
|
||||
static let selectionBorder = accent.withAlphaComponent(0.30)
|
||||
static let ember = NSColor(srgbRed: 0.76, green: 0.27, blue: 0.18, alpha: 1)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class LauncherBackground: NSView {
|
||||
private let amber = NSGradient(colors: [
|
||||
SunsetPalette.accent.withAlphaComponent(0.18),
|
||||
SunsetPalette.accent.withAlphaComponent(0.065),
|
||||
SunsetPalette.accent.withAlphaComponent(0),
|
||||
])!
|
||||
private let ember = NSGradient(colors: [
|
||||
SunsetPalette.ember.withAlphaComponent(0.26),
|
||||
SunsetPalette.ember.withAlphaComponent(0.10),
|
||||
SunsetPalette.ember.withAlphaComponent(0),
|
||||
])!
|
||||
|
||||
override func hitTest(_ point: NSPoint) -> NSView? { nil }
|
||||
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
SunsetPalette.background.setFill()
|
||||
dirtyRect.fill()
|
||||
let upperGlow = NSPoint(x: bounds.width * 0.58, y: bounds.height * 0.94)
|
||||
ember.draw(fromCenter: upperGlow, radius: 0, toCenter: upperGlow,
|
||||
radius: bounds.width * 0.40, options: [])
|
||||
let lowerGlow = NSPoint(x: bounds.width * 0.88, y: bounds.height * 0.10)
|
||||
amber.draw(fromCenter: lowerGlow, radius: 0, toCenter: lowerGlow,
|
||||
radius: bounds.width * 0.55, options: [])
|
||||
let leftGlow = NSPoint(x: bounds.width * 0.08, y: bounds.height * 0.65)
|
||||
NSGraphicsContext.saveGraphicsState()
|
||||
NSGraphicsContext.current?.cgContext.setAlpha(0.45)
|
||||
amber.draw(fromCenter: leftGlow, radius: 0, toCenter: leftGlow,
|
||||
radius: bounds.width * 0.32, options: [])
|
||||
NSGraphicsContext.restoreGraphicsState()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user