Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import SwiftUI
struct TourDemoWindowView: View { let window: TourDemoWindow var decorative = false @Environment(\.colorScheme) private var colorScheme @Environment(\.accessibilityReduceTransparency) private var reduceTransparency @Environment(\.colorSchemeContrast) private var contrast
private var border: Color { decorative || contrast == .increased ? .primary : (window.focused ? .accentColor : .primary) }
private var fill: Color { guard decorative else { return Color(nsColor: window.dimmed ? .windowBackgroundColor : .controlBackgroundColor) } guard let palette = AppearancePaletteColors.curated(.kiln, dark: colorScheme == .dark) else { preconditionFailure("The welcome demo needs its brand palette") } let color = [palette.active, palette.inactive, palette.glow, palette.active][window.id % 4] return Color(red: color.red, green: color.green, blue: color.blue) }
var body: some View { ZStack { RoundedRectangle(cornerRadius: 5) .fill(fill) .strokeBorder( border, style: StrokeStyle( lineWidth: contrast == .increased || (!decorative && window.focused) ? 2 : 1, dash: window.floating ? [3, 2] : [])) if decorative { VStack(alignment: .leading, spacing: 5) { HStack(spacing: 3) { ForEach(0..<3) { _ in Circle().frame(width: 3, height: 3) } } .padding(.bottom, 5) Capsule().frame(height: 3) Capsule().frame(height: 3).padding(.trailing, 12) Spacer(minLength: 0) } .foregroundStyle(.white.opacity(contrast == .increased ? 1 : 0.65)) .padding(8) .clipped() } else { Text((window.id + 1).formatted()) .font(.body.monospacedDigit()) .bold() .foregroundStyle(window.dimmed ? .secondary : .primary) } if window.stackCount > 1 { Image(systemName: "square.on.square") .font(.caption) .foregroundStyle(.primary) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing) .padding(3) } } .opacity(window.dimmed && !reduceTransparency && contrast != .increased ? 0.4 : 1) .accessibilityHidden(true) }}