| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //
- // CVResumeAppearance.swift
- // App for Indeed
- //
- // Shared résumé colours for gallery thumbnails and filled CV preview/export.
- // Résumés always use a print-style light palette regardless of app light/dark mode.
- //
- import AppKit
- @MainActor
- enum CVResumeAppearance {
- struct Colors {
- let paper: NSColor
- let ink: NSColor
- let muted: NSColor
- let rule: NSColor
- let cardBackground: NSColor
- let sidebarTint: NSColor
- let accentRed: NSColor
- let accentBlue: NSColor
- }
- /// Print-style palette — always light, even when the app chrome is in dark mode.
- static func colors() -> Colors {
- Colors(
- paper: NSColor.white,
- ink: NSColor(srgbRed: 38 / 255, green: 50 / 255, blue: 71 / 255, alpha: 1),
- muted: NSColor(srgbRed: 110 / 255, green: 118 / 255, blue: 132 / 255, alpha: 1),
- rule: NSColor(srgbRed: 228 / 255, green: 232 / 255, blue: 240 / 255, alpha: 1),
- cardBackground: NSColor.white,
- sidebarTint: NSColor(srgbRed: 244 / 255, green: 246 / 255, blue: 250 / 255, alpha: 1),
- accentRed: NSColor(srgbRed: 207 / 255, green: 67 / 255, blue: 50 / 255, alpha: 1),
- accentBlue: AppDashboardTheme.brandBlue
- )
- }
- /// Slight paper tint by layout variant (gallery + filled CV use the same rule).
- static func paperBackground(variant: Int, base: NSColor) -> NSColor {
- switch variant % 5 {
- case 0: return base
- case 1: return NSColor(srgbRed: 0.995, green: 0.992, blue: 0.985, alpha: 1)
- case 2: return NSColor(srgbRed: 0.96, green: 0.99, blue: 1, alpha: 1)
- case 3: return NSColor(srgbRed: 0.99, green: 0.99, blue: 0.99, alpha: 1)
- default: return NSColor(srgbRed: 0.99, green: 0.98, blue: 0.995, alpha: 1)
- }
- }
- static func accentColor(for template: CVTemplate) -> NSColor {
- let palette = colors()
- switch template.accent {
- case .redUnderline, .redBar:
- return palette.accentRed
- case .blueBar:
- return template.themeColor
- case .none:
- return template.themeColor.blended(withFraction: 0.5, of: palette.ink) ?? template.themeColor
- }
- }
- static func sectionHeadingColor(for template: CVTemplate) -> NSColor {
- accentColor(for: template)
- }
- }
|