Start shared AppColor.

This commit is contained in:
Brent Simmons 2025-01-27 22:33:54 -08:00
parent 6ed742c5a7
commit 72131c9b56
4 changed files with 68 additions and 13 deletions

View File

@ -95,13 +95,13 @@ struct AppAssets {
return NSImage(systemSymbolName: "line.horizontal.3.decrease.circle", accessibilityDescription: nil)!
}()
static var iconLightBackgroundColor: NSColor = {
return NSColor(named: NSColor.Name("iconLightBackgroundColor"))!
}()
// static var iconLightBackgroundColor: NSColor = {
// return NSColor(named: NSColor.Name("iconLightBackgroundColor"))!
// }()
static var iconDarkBackgroundColor: NSColor = {
return NSColor(named: NSColor.Name("iconDarkBackgroundColor"))!
}()
// static var iconDarkBackgroundColor: NSColor = {
// return NSColor(named: NSColor.Name("iconDarkBackgroundColor"))!
// }()
// static var legacyArticleExtractor: RSImage! = {
// return RSImage(named: "legacyArticleExtractor")
@ -209,10 +209,10 @@ struct AppAssets {
return IconImage(coloredImage, isSymbol: true, isBackgroundSuppressed: true, preferredColor: preferredColor.cgColor)
}()
static var timelineSeparatorColor: NSColor = {
return NSColor(named: "timelineSeparatorColor")!
}()
// static var timelineSeparatorColor: NSColor = {
// return NSColor(named: "timelineSeparatorColor")!
// }()
//
static var timelineStarSelected: RSImage! = {
return RSImage(named: "timelineStar")?.tinted(with: .white)
}()

View File

@ -53,8 +53,8 @@ final class IconView: NSView {
return imageView.frame.size.height < bounds.size.height
}
private static var lightBackgroundColor = AppAssets.iconLightBackgroundColor
private static var darkBackgroundColor = AppAssets.iconDarkBackgroundColor
private static var lightBackgroundColor = AppColor.iconLightBackground
private static var darkBackgroundColor = AppColor.iconDarkBackground
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)

View File

@ -57,7 +57,7 @@ final class TimelineTableRowView: NSTableRowView {
separator = NSView()
separator!.translatesAutoresizingMaskIntoConstraints = false
separator!.wantsLayer = true
separator!.layer?.backgroundColor = AppAssets.timelineSeparatorColor.cgColor
separator!.layer?.backgroundColor = AppColor.timelineSeparator.cgColor
addSubview(separator!)
NSLayoutConstraint.activate([

55
Shared/AppColor.swift Normal file
View File

@ -0,0 +1,55 @@
//
// AppColor.swift
// NetNewsWire
//
// Created by Brent Simmons on 1/27/25.
// Copyright © 2025 Ranchero Software. All rights reserved.
//
import Foundation
#if os(macOS)
import AppKit
#elseif os(iOS)
import UIKit
#endif
struct AppColor {
}
// MARK: - Mac
extension AppColor {
#if os(macOS)
static var iconDarkBackground = color("iconDarkBackgroundColor")
static var iconLightBackground = color("iconLightBackgroundColor")
static var timelineSeparator = color("timelineSeparatorColor")
#endif
}
// MARK: - iOS
extension AppColor {
#if os(iOS)
static var tickMark = color("tickMarkColor")
#endif
}
// MARK: - Private
private extension AppColor {
#if os(macOS)
static func color(_ name: String) -> NSColor {
NSColor(named: name)!
}
#elseif os(iOS)
static func color(_ name: String) -> UIColor {
UIColor(named: name)!
}
#endif
}