Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879public enum ConfigAppearancePalette: String, CaseIterable, Sendable { case system, kiln, tide, grove, iris, dusk, rose}
public enum StackControlsPresentation: String, CaseIterable, Sendable { case onDemand = "on-demand" case persistent}
public enum ConfigAppearanceMode: String, CaseIterable, Sendable { case system, light, dark}
public enum AppearanceColorRole: String, CaseIterable, Sendable { case activeBorder = "active-border-color" case inactiveBorder = "inactive-border-color" case glow = "glow-color" case chipBackground = "chip-background-color" case chipText = "chip-text-color" case stackAccent = "stack-accent-color" case cleanSpaceBackdrop = "clean-space-backdrop-color"}
public struct AppearanceHexColor: Equatable, Sendable { private let rgb: UInt32
public var red: Double { Double((rgb >> 16) & 0xFF) / 255 } public var green: Double { Double((rgb >> 8) & 0xFF) / 255 } public var blue: Double { Double(rgb & 0xFF) / 255 }
public init?(hex: String) { let bytes = hex.utf8 guard bytes.count == 7, bytes.first == 0x23, bytes.dropFirst().allSatisfy({ (0x30...0x39).contains($0) || (0x41...0x46).contains($0) || (0x61...0x66).contains($0) }), let rgb = UInt32(hex.dropFirst(), radix: 16) else { return nil } self.rgb = rgb }
public var hex: String { let digits = String(rgb, radix: 16, uppercase: true) return "#" + String(repeating: "0", count: 6 - digits.count) + digits }}
public struct AppearanceConfiguration: Equatable, Sendable { public static let borderOpacities = 0.0...1.0 public static let borderRadii = 0.0...40.0
public var stackControls: StackControlsPresentation public var palette: ConfigAppearancePalette public var mode: ConfigAppearanceMode public var colors: [AppearanceColorRole: AppearanceHexColor] public var borderOpacity: Double public var borderRadius: Double?
public var isValid: Bool { Self.borderOpacities.contains(borderOpacity) && (borderRadius.map { Self.borderRadii.contains($0) } ?? true) }
public init( stackControls: StackControlsPresentation = .onDemand, palette: ConfigAppearancePalette = .system, mode: ConfigAppearanceMode = .system, colors: [AppearanceColorRole: AppearanceHexColor] = [:], borderOpacity: Double = 1, borderRadius: Double? = nil ) { self.stackControls = stackControls self.palette = palette self.mode = mode self.colors = colors self.borderOpacity = borderOpacity self.borderRadius = borderRadius }}