From f8bf91010c5b66e2ed5ba5fde9bbfdeaa67db3cd Mon Sep 17 00:00:00 2001 From: Lixeas <44436514+Lixeas@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:50:51 +0200 Subject: [PATCH] feat: wire the custom brand mark, replace the cpu SF Symbol - Package.swift bundles Resources/Images (mirrors the existing Fonts resource), loaded via Bundle.module same as AppFonts - BrandMark: loads the light/dark SVG (NSImage supports SVG natively on macOS 12+) matching the current colorScheme, cached per appearance; extracted as its own View since colorScheme isn't reliably readable from the App/Scene body - Dropped .foregroundColor(.secondary): the SVGs are already colored images, not a template glyph - README header now shows the 16-plate logo variant (has its own background, meant standalone) Not done: no .icns/.dmg icon pipeline in release.yml yet (there wasn't one before this change either) -- the app and .dmg still ship with no custom icon. Separate follow-up. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Vag2FZvTekVg34kUeb791Q --- NotchWatch/NotchWatchApp.swift | 3 +-- NotchWatch/Views/BrandMark.swift | 30 ++++++++++++++++++++++++++++++ Package.swift | 3 ++- README.md | 2 ++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 NotchWatch/Views/BrandMark.swift diff --git a/NotchWatch/NotchWatchApp.swift b/NotchWatch/NotchWatchApp.swift index 9164acc..9a4a607 100644 --- a/NotchWatch/NotchWatchApp.swift +++ b/NotchWatch/NotchWatchApp.swift @@ -33,8 +33,7 @@ struct NotchWatchApp: App { VStack(spacing: 0) { // Section titre : logo + nom a gauche, refresh a droite HStack(spacing: 8) { - Image(systemName: "cpu") - .foregroundColor(.secondary) + BrandMark() Text("NotchWatch") .font(.hostGroteskBold(12)) Spacer() diff --git a/NotchWatch/Views/BrandMark.swift b/NotchWatch/Views/BrandMark.swift new file mode 100644 index 0000000..7fff202 --- /dev/null +++ b/NotchWatch/Views/BrandMark.swift @@ -0,0 +1,30 @@ +import SwiftUI +import AppKit + +/// Icone de marque du menu deroulant (remplace le SF Symbol "cpu"). Deux SVG pre-dessines +/// clair/sombre chargees depuis Bundle.module -- pas d'asset catalog dans ce package SPM, donc +/// pas de bascule automatique par apparence : on lit `colorScheme` nous-memes. +struct BrandMark: View { + @Environment(\.colorScheme) private var colorScheme + + private static let size: CGFloat = 16 + private static var cache: [ColorScheme: NSImage] = [:] + + var body: some View { + Image(nsImage: Self.image(for: colorScheme)) + .resizable() + .frame(width: Self.size, height: Self.size) + } + + private static func image(for scheme: ColorScheme) -> NSImage { + if let cached = cache[scheme] { return cached } + + let name = scheme == .dark ? "notchwatch-corbeau-sombre-modified" : "notchwatch-corbeau-clair-modified" + guard let url = Bundle.module.url(forResource: name, withExtension: "svg", subdirectory: "Images"), + let image = NSImage(contentsOf: url) else { + return NSImage() + } + cache[scheme] = image + return image + } +} diff --git a/Package.swift b/Package.swift index 387a2fa..97948e4 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,8 @@ let package = Package( name: "NotchWatch", path: "NotchWatch", resources: [ - .copy("Resources/Fonts") + .copy("Resources/Fonts"), + .copy("Resources/Images") ] ), .testTarget( diff --git a/README.md b/README.md index e91fcaa..c28af70 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +NotchWatch logo + # NotchWatch [![Test](https://github.com/Lixeas/NotchWatch/actions/workflows/test.yml/badge.svg)](https://github.com/Lixeas/NotchWatch/actions/workflows/test.yml)