SPB Git

spb/zyquo-cloud Public MIT

Native macOS AI chat client for 12 cloud providers — your keys, every cloud model, one beautiful chat.

Swift 97.4% Shell 1.7% Makefile 1%
2.7 KB · 83 lines swift
Raw Blame History
1//2//  CloudZGlyph.swift3//  Zyquo Cloud4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  The brand glyph as native SwiftUI drawing — the app icon's Z-command mark9//  (shared with the Zyquo family): a bold rounded Z whose lower stroke10//  resolves into a block caret. Used for the sidebar wordmark and the empty11//  state so the brand mark stays pixel-consistent without raster assets.12//13//  Icon-grid geometry (matches assets/icon/zyquo-cloud.svg):14//  Z stroke (320,310)→(704,310)→(320,700)→(556,700), width 106, round caps;15//  caret rounded rect 653…757 × 585…753 (r24).16//  Bounds incl. caps: x 267…770 (503), y 257…766 (509).17//1819import SwiftUI2021private enum GlyphGrid {22    static let originX: CGFloat = 26723    static let originY: CGFloat = 25724    static let width: CGFloat = 50325    static let height: CGFloat = 50926    /// height / width of the glyph's bounding box.27    static let aspect = height / width2829    static func point(_ x: CGFloat, _ y: CGFloat, in rect: CGRect) -> CGPoint {30        let s = rect.width / width31        return CGPoint(x: (x - originX) * s, y: (y - originY) * s)32    }33}3435/// The rounded Z stroke, lower bar shortened toward the caret.36struct ZStrokeShape: Shape {37    func path(in rect: CGRect) -> Path {38        var path = Path()39        path.move(to: GlyphGrid.point(320, 310, in: rect))40        path.addLine(to: GlyphGrid.point(704, 310, in: rect))41        path.addLine(to: GlyphGrid.point(320, 700, in: rect))42        path.addLine(to: GlyphGrid.point(556, 700, in: rect))43        return path44    }45}4647/// The terminal block caret finishing the lower stroke.48struct CaretShape: Shape {49    func path(in rect: CGRect) -> Path {50        let s = rect.width / GlyphGrid.width51        var path = Path()52        path.addRoundedRect(53            in: CGRect(54                x: (653 - GlyphGrid.originX) * s, y: (585 - GlyphGrid.originY) * s,55                width: 104 * s, height: 168 * s56            ),57            cornerSize: CGSize(width: 24 * s, height: 24 * s)58        )59        return path60    }61}6263/// Composite brand glyph: rounded Z + block caret, single tint.64struct CloudZGlyph: View {65    /// Rendered width; height follows the glyph's natural aspect.66    var size: CGFloat67    var tint: Color = ZyquoColor.accent6869    var body: some View {70        ZStack {71            ZStrokeShape()72                .stroke(style: StrokeStyle(73                    lineWidth: size * 106 / GlyphGrid.width, lineCap: .round, lineJoin: .round74                ))75                .foregroundStyle(tint)76            CaretShape()77                .fill(tint)78        }79        .frame(width: size, height: size * GlyphGrid.aspect)80        .accessibilityHidden(true)81    }82}83