import SwiftUI import JobleyKit /// The "Noticeboard" direction from jobley.ai: paper cream, forest green, a marigold seal. /// The values are the site's `:root` tokens in assets/site.css, light and dark. public enum Theme { public static let background = Color(light: 0xfaf6ee, dark: 0x0d1511) public static let surface = Color(light: 0xfffdf8, dark: 0x16221c) public static let surface2 = Color(light: 0xf7f2e7, dark: 0x1b2922) public static let line = Color(light: 0xe4dccb, dark: 0x25352c) public static let ink = Color(light: 0x15241c, dark: 0xf3efe4) public static let ink2 = Color(light: 0x3c4a42, dark: 0xc5cdc4) public static let muted = Color(light: 0x677268, dark: 0x8f9c93) /// Text and icons in the accent colour. public static let accent = Color(light: 0x17603f, dark: 0x7fd6a6) /// Filled buttons. public static let fill = Color(light: 0x17603f, dark: 0x23784f) public static let seal = Color(hex: 0xf5b83d) public static let sealText = Color(light: 0x8a5a00, dark: 0xf5b83d) public static let danger = Color(light: 0xb3391f, dark: 0xf08a6f) /// Fraunces on the site; the system serif is the closest built-in face. public static func display(_ size: CGFloat, weight: Font.Weight = .semibold) -> Font { .system(size: size, weight: weight, design: .serif) } public static func mono(_ size: CGFloat) -> Font { .system(size: size, design: .monospaced) } } public extension Color { init(hex: UInt32) { self.init(red: Double((hex >> 16) & 0xff) / 255, green: Double((hex >> 8) & 0xff) / 255, blue: Double(hex & 0xff) / 255) } init(light: UInt32, dark: UInt32) { #if os(macOS) self.init(nsColor: NSColor(name: nil) { appearance in let isDark = appearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua return NSColor(Color(hex: isDark ? dark : light)) }) #else self.init(uiColor: UIColor { traits in UIColor(Color(hex: traits.userInterfaceStyle == .dark ? dark : light)) }) #endif } } /// The app mark: a job card with an approval seal (jobley-site/mark.svg), drawn natively. public struct JobleyMark: View { var size: CGFloat public init(size: CGFloat = 28) { self.size = size } public var body: some View { ZStack { RoundedRectangle(cornerRadius: size * 0.24, style: .continuous).fill(Theme.fill) VStack(alignment: .leading, spacing: size * 0.09) { Capsule().fill(.white).frame(width: size * 0.42, height: size * 0.09) Capsule().fill(.white.opacity(0.75)).frame(width: size * 0.3, height: size * 0.07) Capsule().fill(.white.opacity(0.75)).frame(width: size * 0.36, height: size * 0.07) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) .padding(size * 0.2) Circle().fill(Theme.seal).frame(width: size * 0.34) .overlay(Image(systemName: "checkmark").font(.system(size: size * 0.17, weight: .heavy)).foregroundStyle(Color(hex: 0x3a2a05))) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing) .padding(size * 0.12) } .frame(width: size, height: size) .accessibilityHidden(true) } }