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)