Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions NotchWatch/NotchWatchApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
30 changes: 30 additions & 0 deletions NotchWatch/Views/BrandMark.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ let package = Package(
name: "NotchWatch",
path: "NotchWatch",
resources: [
.copy("Resources/Fonts")
.copy("Resources/Fonts"),
.copy("Resources/Images")
]
),
.testTarget(
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img src="NotchWatch/Resources/Images/notchwatch-corbeau-16-modified.svg" width="64" height="64" alt="NotchWatch logo">

# NotchWatch

[![Test](https://github.com/Lixeas/NotchWatch/actions/workflows/test.yml/badge.svg)](https://github.com/Lixeas/NotchWatch/actions/workflows/test.yml)
Expand Down
Loading