| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // CVResumeAppearance.swift
- // App for Indeed
- //
- // Shared résumé colours for gallery thumbnails and filled CV preview/export.
- // Tracks app light / dark mode so the selected template looks the same everywhere.
- //
- 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
- }
- static var isDark: Bool { AppAppearanceManager.shared.isDark }
- static func colors(isDark dark: Bool? = nil) -> Colors {
- let dark = dark ?? isDark
- if dark {
- return Colors(
- paper: NSColor(srgbRed: 28 / 255, green: 30 / 255, blue: 36 / 255, alpha: 1),
- ink: NSColor(srgbRed: 0.94, green: 0.95, blue: 0.97, alpha: 1),
- muted: NSColor(srgbRed: 0.62, green: 0.66, blue: 0.72, alpha: 1),
- rule: NSColor(srgbRed: 0.38, green: 0.40, blue: 0.46, alpha: 1),
- cardBackground: NSColor(srgbRed: 32 / 255, green: 34 / 255, blue: 40 / 255, alpha: 1),
- sidebarTint: NSColor(srgbRed: 40 / 255, green: 42 / 255, blue: 48 / 255, alpha: 1),
- accentRed: NSColor(srgbRed: 235 / 255, green: 88 / 255, blue: 72 / 255, alpha: 1),
- accentBlue: AppDashboardTheme.brandBlue
- )
- }
- return 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: AppDashboardTheme.cvMakerPreviewSidebarTint,
- 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 {
- guard !isDark else { return base }
- 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)
- }
- }
|