Skip to content

CodexBar 是一个 macOS 菜单栏应用,用于查看本机 Codex 账号状态、额度、Token 用量、详细统计信息

refactor: 统一界面色彩定义并平滑额度配色

Bobdeffa15b481e
diff --git a/CodexBar/Controllers/FallbackPanelController.swift b/CodexBar/Controllers/FallbackPanelController.swift
index a4f8772..175326a 100644
--- a/CodexBar/Controllers/FallbackPanelController.swift
+++ b/CodexBar/Controllers/FallbackPanelController.swift
@@ -82,7 +82,7 @@ final class FallbackPanelController {
panel.contentViewController = makeContentController()
panel.isReleasedWhenClosed = false
panel.isOpaque = false
- panel.backgroundColor = .clear
+ panel.backgroundColor = NSColor.clear
panel.hasShadow = true
panel.level = .popUpMenu
panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
diff --git a/CodexBar/Controllers/SidePanelSupport.swift b/CodexBar/Controllers/SidePanelSupport.swift
index 7a76c96..a3bb378 100644
--- a/CodexBar/Controllers/SidePanelSupport.swift
+++ b/CodexBar/Controllers/SidePanelSupport.swift
@@ -85,7 +85,7 @@ enum SidePanelSupport {
backing: .buffered,
defer: false
)
- panel.backgroundColor = .clear
+ panel.backgroundColor = NSColor.clear
panel.collectionBehavior = [.transient, .canJoinAllSpaces, .fullScreenAuxiliary]
panel.hasShadow = true
panel.hidesOnDeactivate = false
diff --git a/CodexBar/Models/TaskGlowPresentationState.swift b/CodexBar/Models/TaskGlowPresentationState.swift
index 3c6f2cc..39b5685 100644
--- a/CodexBar/Models/TaskGlowPresentationState.swift
+++ b/CodexBar/Models/TaskGlowPresentationState.swift
@@ -195,7 +195,7 @@ enum TaskGlowState {
func color(in appearance: TaskGlowAppearance) -> NSColor {
switch self {
- case .hidden: .clear
+ case .hidden: NSColor.clear
case .running: appearance.color(for: .running)
case .waiting: appearance.color(for: .waiting)
case .completed: appearance.color(for: .completed)
diff --git a/CodexBar/Services/Settings/TaskGlowSettings.swift b/CodexBar/Services/Settings/TaskGlowSettings.swift
index d8006d0..363cff8 100644
--- a/CodexBar/Services/Settings/TaskGlowSettings.swift
+++ b/CodexBar/Services/Settings/TaskGlowSettings.swift
@@ -16,10 +16,10 @@ enum TaskGlowColorRole: String, CaseIterable {
var defaultColor: NSColor {
switch self {
- case .running: .systemCyan
- case .waiting: .systemOrange
- case .completed: .systemGreen
- case .terminated: .systemRed
+ case .running: NSColor.systemCyan
+ case .waiting: NSColor.systemOrange
+ case .completed: NSColor.systemGreen
+ case .terminated: NSColor.systemRed
}
}
}
diff --git a/CodexBar/Views/Log/LogMethodFilter.swift b/CodexBar/Views/Log/LogMethodFilter.swift
index a53403c..0402497 100644
--- a/CodexBar/Views/Log/LogMethodFilter.swift
+++ b/CodexBar/Views/Log/LogMethodFilter.swift
@@ -99,7 +99,7 @@ struct LogMethodFilter: View {
ProgressView().frame(maxWidth: .infinity, maxHeight: .infinity)
} else if let errorMessage {
Text(errorMessage)
- .foregroundStyle(.red)
+ .foregroundStyle(Color.red)
.padding()
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if matchingMethods.isEmpty {
diff --git a/CodexBar/Views/Log/LogPreview.swift b/CodexBar/Views/Log/LogPreview.swift
index fedd2c8..c2ad583 100644
--- a/CodexBar/Views/Log/LogPreview.swift
+++ b/CodexBar/Views/Log/LogPreview.swift
@@ -101,22 +101,22 @@ private nonisolated enum LogCodePreviewFormatter {
private static func color(for token: String, in text: NSString, range: NSRange) -> NSColor {
if token.hasPrefix("\"") {
- return isJSONKey(in: text, after: range) ? .systemBlue : .systemGreen
+ return isJSONKey(in: text, after: range) ? NSColor.systemBlue : NSColor.systemGreen
}
if token == "true" || token == "false" {
- return .systemOrange
+ return NSColor.systemOrange
}
if token == "null" {
- return .secondaryLabelColor
+ return NSColor.secondaryLabelColor
}
if token.first?.isNumber == true || token.hasPrefix("-") {
- return .systemPurple
+ return NSColor.systemPurple
}
- return .tertiaryLabelColor
+ return NSColor.tertiaryLabelColor
}
private static func isJSONKey(in text: NSString, after range: NSRange) -> Bool {
@@ -289,13 +289,13 @@ final class LogPreviewScrollView: NSScrollView {
hasHorizontalScroller = true
autohidesScrollers = false
drawsBackground = true
- backgroundColor = .textBackgroundColor
+ backgroundColor = NSColor.textBackgroundColor
let textView = NSTextView(frame: NSRect(origin: .zero, size: fittedSize), textContainer: document.container)
textView.isEditable = false
textView.isSelectable = true
textView.isRichText = true
textView.drawsBackground = true
- textView.backgroundColor = .textBackgroundColor
+ textView.backgroundColor = NSColor.textBackgroundColor
textView.textContainerInset = Self.textInset
textView.minSize = .zero
textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
diff --git a/CodexBar/Views/Log/LogView.swift b/CodexBar/Views/Log/LogView.swift
index 8192e79..4ac62ea 100644
--- a/CodexBar/Views/Log/LogView.swift
+++ b/CodexBar/Views/Log/LogView.swift
@@ -32,7 +32,7 @@ struct LogView: View {
if let error = store.errorMessage {
Text(error)
.font(LogTypography.captionFont)
- .foregroundStyle(.red)
+ .foregroundStyle(Color.red)
.padding(8)
}
@@ -156,7 +156,7 @@ struct LogView: View {
}
}
.onDisappear { scrollPosition = ScrollPosition(idType: UUID.self, edge: .top) }
- .background(Color(nsColor: .textBackgroundColor))
+ .background(Color(nsColor: NSColor.textBackgroundColor))
}
static func shouldLoadMore(from previousPhase: ScrollPhase, to phase: ScrollPhase, geometry: ScrollGeometry) -> Bool {
@@ -195,7 +195,7 @@ private struct LogRow: View {
time: entry.requestedAt,
text: request,
inline: currentInlinePreview?.request,
- color: .primary
+ color: Color.primary
)
}
@@ -205,7 +205,7 @@ private struct LogRow: View {
time: entry.respondedAt,
text: detail,
inline: currentInlinePreview?.detail,
- color: entry.status == .failure ? .red : .primary
+ color: entry.status == .failure ? Color.red : Color.primary
)
} else if entry.status == .pending {
Text("log.status.waiting-response")
@@ -428,10 +428,10 @@ private extension AppServerLogEntry.Source {
private extension AppServerLogEntry.Status {
var tint: Color {
switch self {
- case .pending: .orange
- case .success: .green
- case .failure: .red
- case .information: .blue
+ case .pending: Color.orange
+ case .success: Color.green
+ case .failure: Color.red
+ case .information: Color.blue
}
}
}
diff --git a/CodexBar/Views/Menu/ActivityCard.swift b/CodexBar/Views/Menu/ActivityCard.swift
index 2460e88..961a7ca 100644
--- a/CodexBar/Views/Menu/ActivityCard.swift
+++ b/CodexBar/Views/Menu/ActivityCard.swift
@@ -496,14 +496,14 @@ struct ActivityCard: View {
return activeContent(
for: task,
symbolName: "hand.raised.fill",
- tint: .orange,
+ tint: Color.orange,
waiting: true
)
case let .running(task):
return activeContent(
for: task,
symbolName: "bolt.fill",
- tint: .blue,
+ tint: Color.blue,
waiting: false
)
case let .completed(completion):
@@ -515,7 +515,7 @@ struct ActivityCard: View {
taskID: completion.taskID ?? completion.id,
projectName: completion.projectName,
symbolName: "checkmark.circle.fill",
- tint: .green,
+ tint: Color.green,
detail: nil,
tokenUsage: completion.tokenUsage,
header: [
@@ -532,7 +532,7 @@ struct ActivityCard: View {
taskID: termination.taskID ?? termination.id,
projectName: termination.projectName,
symbolName: "xmark.circle.fill",
- tint: .red,
+ tint: Color.red,
detail: ActivityLiveLabel(termination.isFailure ? "failed" : "interrupted").text,
tokenUsage: termination.tokenUsage,
header: [
@@ -543,7 +543,7 @@ struct ActivityCard: View {
case .idle:
return ActivityCardContent(
symbolName: "bubble.left.and.exclamationmark.bubble.right",
- tint: .red,
+ tint: Color.red,
detail: activityMonitor.sourcePresentation?.text,
header: [String(localized: "common.codex")]
)
diff --git a/CodexBar/Views/Menu/ActivityCardWaitingEdges.swift b/CodexBar/Views/Menu/ActivityCardWaitingEdges.swift
index f3f0d7f..f7ce163 100644
--- a/CodexBar/Views/Menu/ActivityCardWaitingEdges.swift
+++ b/CodexBar/Views/Menu/ActivityCardWaitingEdges.swift
@@ -38,8 +38,8 @@ private struct ActivityCardWaitingEdge: View {
private var amber: Color {
colorScheme == .dark
- ? Color(red: 1, green: 0.76, blue: 0.40)
- : Color(red: 0.95, green: 0.58, blue: 0.18)
+ ? Color(displayP3Hex: 0xF6C475)
+ : Color(displayP3Hex: 0xE59846)
}
private var breathIntensity: Double {
@@ -62,7 +62,7 @@ private struct ActivityCardWaitingEdge: View {
.init(color: amber.opacity(0.65), location: 0.20),
.init(color: amber.opacity(0.25), location: 0.50),
.init(color: amber.opacity(0.05), location: 0.78),
- .init(color: .clear, location: 1)
+ .init(color: Color.clear, location: 1)
]),
startPoint: CGPoint(x: isLeading ? 0 : size.width, y: 0),
endPoint: CGPoint(x: isLeading ? size.width : 0, y: 0)
@@ -73,9 +73,9 @@ private struct ActivityCardWaitingEdge: View {
.mask {
LinearGradient(
stops: [
- .init(color: .black, location: 0),
- .init(color: .black, location: 0.5),
- .init(color: .clear, location: 1)
+ .init(color: Color.black, location: 0),
+ .init(color: Color.black, location: 0.5),
+ .init(color: Color.clear, location: 1)
],
startPoint: isLeading ? .leading : .trailing,
endPoint: isLeading ? .trailing : .leading
diff --git a/CodexBar/Views/Menu/ActivityCenterView.swift b/CodexBar/Views/Menu/ActivityCenterView.swift
index 5952414..b116e1e 100644
--- a/CodexBar/Views/Menu/ActivityCenterView.swift
+++ b/CodexBar/Views/Menu/ActivityCenterView.swift
@@ -157,7 +157,7 @@ struct ActivityCenterView: View {
taskSection(
title: "activity-center.section.waiting",
symbolName: "hand.raised.fill",
- tint: .orange,
+ tint: Color.orange,
tasks: activityMonitor.snapshot.panelWaitingTasks,
now: now,
isWaiting: true
@@ -168,7 +168,7 @@ struct ActivityCenterView: View {
taskSection(
title: "activity-center.section.running",
symbolName: "bolt.fill",
- tint: .blue,
+ tint: Color.blue,
tasks: activityMonitor.snapshot.panelRunningTasks,
now: now,
isWaiting: false
@@ -291,7 +291,7 @@ struct ActivityCenterView: View {
Text(verbatim: "\(count)")
.font(.caption2.monospacedDigit())
- .foregroundStyle(Color(nsColor: .tertiaryLabelColor))
+ .foregroundStyle(Color(nsColor: NSColor.tertiaryLabelColor))
.numericTransition(value: count, comparison: Double(count))
}
.frame(height: Metrics.sectionHeaderHeight)
@@ -321,7 +321,7 @@ struct ActivityCenterView: View {
private func completionRow(_ completion: ActivityCompletion, now: Date) -> some View {
row(
symbolName: "checkmark.circle.fill",
- tint: .green,
+ tint: Color.green,
projectName: completion.projectName,
modelName: completion.modelName,
effort: completion.effort,
@@ -339,7 +339,7 @@ struct ActivityCenterView: View {
private func terminationRow(_ termination: ActivityTermination, now: Date) -> some View {
row(
symbolName: termination.isFailure ? "exclamationmark.circle.fill" : "xmark.circle.fill",
- tint: .red,
+ tint: Color.red,
projectName: termination.projectName,
modelName: termination.modelName,
effort: termination.effort,
diff --git a/CodexBar/Views/Menu/ActivityStatusText.swift b/CodexBar/Views/Menu/ActivityStatusText.swift
index fdb1a56..6a7506f 100644
--- a/CodexBar/Views/Menu/ActivityStatusText.swift
+++ b/CodexBar/Views/Menu/ActivityStatusText.swift
@@ -21,7 +21,7 @@ struct ActivityStatusText: View {
ActivityStatusShimmer()
.mask {
label
- .foregroundStyle(.white)
+ .foregroundStyle(Color.white)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
}
.allowsHitTesting(false)
@@ -113,8 +113,8 @@ private struct ActivityIonizationParticles: View {
TimelineView(.animation) { timeline in
let elapsed = timeline.date.timeIntervalSince(startedAt)
Canvas { context, _ in
- context.addFilter(.shadow(color: .orange.opacity(0.9), radius: 4.0 / 3))
- context.addFilter(.shadow(color: .orange.opacity(0.5), radius: 4))
+ context.addFilter(.shadow(color: Color.orange.opacity(0.9), radius: 4.0 / 3))
+ context.addFilter(.shadow(color: Color.orange.opacity(0.5), radius: 4))
for emitter in emitters {
for index in 0 ..< 12 {
let seed = emitter.seed + index
@@ -128,7 +128,7 @@ private struct ActivityIonizationParticles: View {
particleContext.opacity = 1 - life
particleContext.fill(
Path(ellipseIn: CGRect(x: x - 1.5, y: y - 1.5, width: 3, height: 3)),
- with: .color(.orange)
+ with: .color(Color.orange)
)
}
}
@@ -156,7 +156,7 @@ private struct ActivityStatusShimmer: View {
let width = geometry.size.width * 0.4
LinearGradient(
- colors: [.clear, .white, .clear],
+ colors: [Color.clear, Color.white, Color.clear],
startPoint: .leading,
endPoint: .trailing
)
diff --git a/CodexBar/Views/Menu/CodexServiceStatusRow.swift b/CodexBar/Views/Menu/CodexServiceStatusRow.swift
index 9d048c9..c014e2d 100644
--- a/CodexBar/Views/Menu/CodexServiceStatusRow.swift
+++ b/CodexBar/Views/Menu/CodexServiceStatusRow.swift
@@ -91,7 +91,7 @@ struct CodexServiceStatusRow: View {
private var statusColor: Color {
switch monitor.state {
case let .available(status): status.level.tint(for: colorScheme)
- case .checking, .unavailable: .secondary
+ case .checking, .unavailable: Color.secondary
}
}
}
@@ -119,11 +119,11 @@ private extension CodexServiceStatus.Level {
func tint(for colorScheme: ColorScheme) -> Color {
switch self {
- case .operational: .green
- case .degradedPerformance: Color(hex: colorScheme == .dark ? 0xFEF3C7 : 0xC08A00)
- case .partialOutage: .orange
- case .fullOutage: .red
- case .underMaintenance: .blue
+ case .operational: Color.green
+ case .degradedPerformance: Color(displayP3Hex: colorScheme == .dark ? 0xFCF3CC : 0xB88C2E)
+ case .partialOutage: Color.orange
+ case .fullOutage: Color.red
+ case .underMaintenance: Color.blue
}
}
}
diff --git a/CodexBar/Views/Menu/CodexStatusMenuSections.swift b/CodexBar/Views/Menu/CodexStatusMenuSections.swift
index 968c052..4913c35 100644
--- a/CodexBar/Views/Menu/CodexStatusMenuSections.swift
+++ b/CodexBar/Views/Menu/CodexStatusMenuSections.swift
@@ -73,22 +73,22 @@ struct AccountCard: View {
private static func planBadgeTint(for plan: String, colorScheme: ColorScheme) -> Color {
let normalizedPlan = plan.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
let colors = planTints.first { $0.plans.contains(normalizedPlan) }?.colors
- ?? (light: 0x69717A, dark: 0xB1B7C0)
- return Color(hex: colorScheme == .dark ? colors.dark : colors.light)
+ ?? (light: 0x6A7179, dark: 0xB2B7BF)
+ return Color(displayP3Hex: colorScheme == .dark ? colors.dark : colors.light)
}
/// 按完整套餐名归入产品系列, 避免复合名称被其他系列匹配
private static let planTints: [(plans: [String], colors: (light: Int, dark: Int))] = [
- (["free"], (0x527566, 0xA3C8B5)),
- (["go"], (0x237D72, 0x77C9B6)),
- (["plus"], (0x366FA8, 0x8FBCEB)),
- (["prolite"], (0x6676AF, 0xB0BCEB)),
- (["pro"], (0x8055AB, 0xC5A5E8)),
- (["promax"], (0x986B2F, 0xE2BF7F)),
- (["team"], (0x287D94, 0x83C9DC)),
- (["business", "self_serve_business_prolite", "self_serve_business_usage_based"], (0xA1654B, 0xDDAF95)),
- (["enterprise", "ent26", "enterprise_cbp_automation", "enterprise_cbp_usage_based"], (0x566780, 0xAABBD5)),
- (["edu", "edu_plus", "edu_pro"], (0xA0567C, 0xDEABC9))
+ (["free"], (0x597467, 0xAAC7B6)),
+ (["go"], (0x3F7B72, 0x8AC7B7)),
+ (["plus"], (0x446EA3, 0x98BBE7)),
+ (["prolite"], (0x6976AB, 0xB2BCE7)),
+ (["pro"], (0x7A57A6, 0xC0A6E3)),
+ (["promax"], (0x916D3A, 0xDCC087)),
+ (["team"], (0x427B91, 0x93C7DA)),
+ (["business", "self_serve_business_prolite", "self_serve_business_usage_based"], (0x986850, 0xD6B199)),
+ (["enterprise", "ent26", "enterprise_cbp_automation", "enterprise_cbp_usage_based"], (0x59667E, 0xADBAD3)),
+ (["edu", "edu_plus", "edu_pro"], (0x965A7A, 0xD6ADC7))
]
}
@@ -137,13 +137,13 @@ struct StatusAccountCard: View {
private var statusDisplay: StatusDisplay {
switch loadState {
case .notLoggedIn:
- StatusDisplay(text: LocalizedStringResource("codex-status.account.not-signed-in"), color: .orange)
+ StatusDisplay(text: LocalizedStringResource("codex-status.account.not-signed-in"), color: Color.orange)
case let .unsupportedVersion(minimum):
- StatusDisplay(text: LocalizedStringResource("codex-version.requirement", defaultValue: "\(minimum)"), color: .red)
+ StatusDisplay(text: LocalizedStringResource("codex-version.requirement", defaultValue: "\(minimum)"), color: Color.red)
case .initializationFailed:
- StatusDisplay(text: LocalizedStringResource("codex-status.account.initialization-failed"), color: .red)
+ StatusDisplay(text: LocalizedStringResource("codex-status.account.initialization-failed"), color: Color.red)
case .loading, .loaded:
- StatusDisplay(text: nil, color: .accentColor)
+ StatusDisplay(text: nil, color: Color.accentColor)
}
}
}
@@ -247,7 +247,7 @@ struct QuotaLimitsSection: View {
let value = creditsDisplayValue(credits)
metadataCapsule(
String(localized: "quota.credits.value", defaultValue: "\(value)"),
- tint: credits.unlimited || credits.hasCredits ? .green : .orange
+ tint: credits.unlimited || credits.hasCredits ? Color.green : Color.orange
)
}
@@ -304,7 +304,7 @@ struct QuotaLimitsSection: View {
.buttonStyle(.plain)
}
- private func metadataCapsule(_ text: String, tint: Color = .green) -> some View {
+ private func metadataCapsule(_ text: String, tint: Color = Color.green) -> some View {
Text(text)
.font(MenuMetrics.badgeFont)
.foregroundStyle(tint)
@@ -336,7 +336,7 @@ struct UpdatedAtRow: View {
startedAt: updatedAt,
interval: countdownInterval,
isActive: isCountdownActive,
- color: .blue
+ color: Color.blue
)
HStack(spacing: 5) {
@@ -408,13 +408,13 @@ struct SyncDisplayState: Equatable {
} else if settings.hasSyncFailure {
self.init(
symbolName: "exclamationmark.icloud",
- tint: .orange,
+ tint: Color.orange,
helpText: settings.syncFailureMessage ?? SyncFailureReason.retryLater.message
)
} else {
self.init(
symbolName: "icloud",
- tint: .codexSecondaryLabel,
+ tint: Color.codexSecondaryLabel,
helpText: settings.lastUploadAtText.map { String(localized: "sync.status.last-sync-time", defaultValue: "\($0)") }
?? String(localized: "sync.status.no-history")
)
@@ -429,13 +429,13 @@ struct SyncDisplayState: Equatable {
private static let disabled = SyncDisplayState(
symbolName: "icloud.slash",
- tint: .codexSecondaryLabel,
+ tint: Color.codexSecondaryLabel,
helpText: String(localized: "sync.status.disabled")
)
private static let syncing = SyncDisplayState(
symbolName: "arrow.trianglehead.clockwise.icloud",
- tint: .blue,
+ tint: Color.blue,
helpText: String(localized: "sync.status.syncing")
)
}
diff --git a/CodexBar/Views/Menu/HeatmapDetailView.swift b/CodexBar/Views/Menu/HeatmapDetailView.swift
index 63c5698..ff96307 100644
--- a/CodexBar/Views/Menu/HeatmapDetailView.swift
+++ b/CodexBar/Views/Menu/HeatmapDetailView.swift
@@ -35,7 +35,7 @@ struct HeatmapDetailView: View {
dateText
.padding(.horizontal, 7)
.padding(.vertical, 3)
- .liquidGlassCapsule(tint: .accentColor)
+ .liquidGlassCapsule(tint: Color.accentColor)
Spacer(minLength: 8)
@@ -89,14 +89,14 @@ struct HeatmapDetailView: View {
let tokenUsage = context.period.tokenUsage
let cacheHitRate = tokenUsage?.cacheHitRate ?? 0
return Grid(alignment: .leading, horizontalSpacing: Metrics.metricRowSpacing, verticalSpacing: Metrics.metricSpacing) {
- tokenUsageRow("usage.token-usage.total", tokens: tokenUsage?.totalTokens, tint: .blue)
- tokenUsageRow("usage.token-usage.output", tokens: tokenUsage?.outputTokens, tint: .orange)
- tokenUsageRow("usage.token-usage.input", tokens: tokenUsage?.inputTokens, tint: .indigo)
- tokenUsageRow("usage.token-usage.reasoning-output", tokens: tokenUsage?.reasoningOutputTokens, tint: .cyan)
- tokenUsageRow("usage.token-usage.cache-write-input", tokens: tokenUsage?.cacheWriteInputTokens, tint: .purple)
- tokenUsageRow("usage.token-usage.cached-input", tokens: tokenUsage?.cachedInputTokens, tint: .green)
+ tokenUsageRow("usage.token-usage.total", tokens: tokenUsage?.totalTokens, tint: Color.blue)
+ tokenUsageRow("usage.token-usage.output", tokens: tokenUsage?.outputTokens, tint: Color.orange)
+ tokenUsageRow("usage.token-usage.input", tokens: tokenUsage?.inputTokens, tint: Color.indigo)
+ tokenUsageRow("usage.token-usage.reasoning-output", tokens: tokenUsage?.reasoningOutputTokens, tint: Color.cyan)
+ tokenUsageRow("usage.token-usage.cache-write-input", tokens: tokenUsage?.cacheWriteInputTokens, tint: Color.purple)
+ tokenUsageRow("usage.token-usage.cached-input", tokens: tokenUsage?.cachedInputTokens, tint: Color.green)
metricRowLayout {
- metricDot(tint: .teal)
+ metricDot(tint: Color.teal)
Text("usage.token-usage.cache-hit-rate")
.foregroundStyle(.secondary)
.fixedSize(horizontal: true, vertical: false)
@@ -130,7 +130,7 @@ struct HeatmapDetailView: View {
private var mostUsedModelMetricRow: some View {
metricRowLayout {
- metricDot(tint: .cyan)
+ metricDot(tint: Color.cyan)
Text("usage.heatmap.top-model")
.foregroundStyle(.secondary)
.fixedSize(horizontal: true, vertical: false)
@@ -167,32 +167,32 @@ struct HeatmapDetailView: View {
ActivityMetricRow(
label: String(localized: "history.activity-data.threads"),
value: context.period.activityData.threadCount,
- tint: .green
+ tint: Color.green
),
ActivityMetricRow(
label: String(localized: "history.activity-data.turns"),
value: context.period.activityData.turnCount,
- tint: .teal
+ tint: Color.teal
),
ActivityMetricRow(
label: String(localized: "history.activity-data.subagents"),
value: context.period.activityData.subagentCount,
- tint: .indigo
+ tint: Color.indigo
),
ActivityMetricRow(
label: String(localized: "history.activity-data.tool-calls"),
value: context.period.activityData.toolCallCount,
- tint: .orange
+ tint: Color.orange
),
ActivityMetricRow(
label: String(localized: "history.activity-data.approvals"),
value: context.period.activityData.approvalRequestedCount,
- tint: .red
+ tint: Color.red
),
ActivityMetricRow(
label: String(localized: "history.activity-data.compactions"),
value: context.period.activityData.contextCompactionCount,
- tint: .purple
+ tint: Color.purple
)
]
}
diff --git a/CodexBar/Views/Menu/QuotaRow.swift b/CodexBar/Views/Menu/QuotaRow.swift
index dcd1c15..9bfd69d 100644
--- a/CodexBar/Views/Menu/QuotaRow.swift
+++ b/CodexBar/Views/Menu/QuotaRow.swift
@@ -171,8 +171,8 @@ private enum QuotaBarPalette {
}
let progress = (currentPercent - transitionStart) / colorTransitionSpan
- return Color(hex: lowerTier.hex).mix(
- with: Color(hex: upperTier.hex),
+ return Color(displayP3Hex: lowerTier.hex).mix(
+ with: Color(displayP3Hex: upperTier.hex),
by: smoothStep(progress),
in: .device
)
@@ -181,7 +181,7 @@ private enum QuotaBarPalette {
return QuotaPalette.color(for: Int(currentPercent.rounded()))
}
- static let placeholderColor = Color(hex: 0xE5E7EB)
+ static let placeholderColor = Color(displayP3Hex: 0xE5E7EB)
private static let colorTransitionSpan = 4.0
private static func smoothStep(_ value: Double) -> Double {
diff --git a/CodexBar/Views/Menu/ResetCreditsPanelView.swift b/CodexBar/Views/Menu/ResetCreditsPanelView.swift
index d0f6ec9..86cf698 100644
--- a/CodexBar/Views/Menu/ResetCreditsPanelView.swift
+++ b/CodexBar/Views/Menu/ResetCreditsPanelView.swift
@@ -124,11 +124,11 @@ struct ResetCreditsPanelView: View {
.fill(
LinearGradient(
colors: [
- .clear,
- .primary.opacity(0.18),
- .green.opacity(0.16),
- .primary.opacity(0.18),
- .clear
+ Color.clear,
+ Color.primary.opacity(0.18),
+ Color.green.opacity(0.16),
+ Color.primary.opacity(0.18),
+ Color.clear
],
startPoint: .leading,
endPoint: .trailing
@@ -166,12 +166,12 @@ struct ResetCreditsPanelView: View {
}
private func availableValue(for group: ResetCreditExpirationGroup) -> some View {
- let tint: Color = if group.isExpiringUrgently {
- .red
+ let tint = if group.isExpiringUrgently {
+ Color.red
} else if group.isExpiringSoon {
- .orange
+ Color.orange
} else {
- .green
+ Color.green
}
return Text(LocalizedStringResource("banked-reset.available-count", defaultValue: "\(group.count, specifier: "%lld")"))
diff --git a/CodexBar/Views/Menu/StatusItemIconView.swift b/CodexBar/Views/Menu/StatusItemIconView.swift
index 3f0da9a..03a32ea 100644
--- a/CodexBar/Views/Menu/StatusItemIconView.swift
+++ b/CodexBar/Views/Menu/StatusItemIconView.swift
@@ -111,7 +111,7 @@ struct StatusItemIconView: View {
let style = StrokeStyle(lineWidth: Metrics.lineWidth, lineCap: .round)
return ZStack {
StatusItemIndicatorArc(radius: radius, startAngle: startAngle, sweepAngle: sweepAngle)
- .stroke(Color(nsColor: .tertiaryLabelColor).opacity(0.34), style: style)
+ .stroke(Color(nsColor: NSColor.tertiaryLabelColor).opacity(0.34), style: style)
.opacity(indicator.isVisible ? 1 : 0)
StatusItemIndicatorArc(
radius: radius,
@@ -129,10 +129,10 @@ struct StatusItemIconView: View {
private var symbolColor: Color {
if presentation.state.isUnavailable {
- return .primary
+ return Color.primary
}
- guard presentation.state.isOrdinaryUsageRestricted else { return .primary }
- return Color(hex: colorScheme == .dark ? 0xE8B27C : 0xD99858)
+ guard presentation.state.isOrdinaryUsageRestricted else { return Color.primary }
+ return Color(displayP3Hex: colorScheme == .dark ? 0xE0B484 : 0xCF9B62)
}
@ViewBuilder
@@ -153,7 +153,7 @@ struct StatusItemIconView: View {
// 只在图形或屏幕倍率首次出现时栅格化, 缩放过程复用普通图片
let renderer = ImageRenderer(content: symbolContent(named: name)
- .foregroundStyle(.white)
+ .foregroundStyle(Color.white)
.environment(\.displayScale, displayScale))
renderer.scale = scale
guard let image = renderer.cgImage else {
diff --git a/CodexBar/Views/Menu/UsageHeatmap.swift b/CodexBar/Views/Menu/UsageHeatmap.swift
index 4065282..38e74a4 100644
--- a/CodexBar/Views/Menu/UsageHeatmap.swift
+++ b/CodexBar/Views/Menu/UsageHeatmap.swift
@@ -470,7 +470,7 @@ private struct UsageHeatmapSquare: View {
private var borderColor: Color {
if colorScheme == .dark {
- return isHovered ? CodexDarkPalette.heatmap.opacity(0.55) : .clear
+ return isHovered ? CodexDarkPalette.heatmap.opacity(0.55) : Color.clear
}
guard tokenState.count != nil else {
return Color.secondary.opacity(isHovered ? 0.42 : 0.12)
@@ -483,6 +483,6 @@ private struct UsageHeatmapSquare: View {
}
private var shadowColor: Color {
- colorScheme == .dark || tokenState.count == nil ? .clear : .blue.opacity(0.22)
+ colorScheme == .dark || tokenState.count == nil ? Color.clear : Color.blue.opacity(0.22)
}
}
diff --git a/CodexBar/Views/Settings/AppSettingsView.swift b/CodexBar/Views/Settings/AppSettingsView.swift
index cde0e8b..23ad43f 100644
--- a/CodexBar/Views/Settings/AppSettingsView.swift
+++ b/CodexBar/Views/Settings/AppSettingsView.swift
@@ -243,8 +243,8 @@ private extension AppSettingsView {
.background {
if isSelected {
shape
- .fill(.clear)
- .liquidGlassBadge(tint: .accentColor, in: shape, showsTopHighlight: false)
+ .fill(Color.clear)
+ .liquidGlassBadge(tint: Color.accentColor, in: shape, showsTopHighlight: false)
}
}
}
@@ -1008,7 +1008,7 @@ private extension AppSettingsView {
} label: {
Label("app.action.quit", systemImage: "power.circle")
}
- .foregroundStyle(.red)
+ .foregroundStyle(Color.red)
.keyboardShortcut("q")
}
}
diff --git a/CodexBar/Views/Settings/CodexVersionSection.swift b/CodexBar/Views/Settings/CodexVersionSection.swift
index f68aa0e..759a95e 100644
--- a/CodexBar/Views/Settings/CodexVersionSection.swift
+++ b/CodexBar/Views/Settings/CodexVersionSection.swift
@@ -71,7 +71,7 @@ struct CodexVersionSection: View {
}
.buttonStyle(.plain)
.controlSize(.small)
- .foregroundStyle(isEnabled ? Color.accentColor : .secondary)
+ .foregroundStyle(isEnabled ? Color.accentColor : Color.secondary)
.disabled(!isEnabled)
.help(label)
}
@@ -94,10 +94,10 @@ struct CodexVersionSection: View {
HStack(spacing: 12) {
Text("settings.codex.daemon.in-use")
.font(SettingsRowMetrics.badgeFont)
- .foregroundStyle(.green)
+ .foregroundStyle(Color.green)
.padding(.horizontal, 6)
.padding(.vertical, 2)
- .liquidGlassCapsule(tint: .green)
+ .liquidGlassCapsule(tint: Color.green)
Text(info.version)
.monospacedDigit()
@@ -134,7 +134,7 @@ struct CodexVersionSection: View {
Text(item.displayVersion)
.font(hasVersion ? SettingsRowMetrics.bodyFont.monospacedDigit() : SettingsRowMetrics.bodyFont)
- .foregroundStyle(Color(nsColor: hasVersion ? .secondaryLabelColor : .tertiaryLabelColor))
+ .foregroundStyle(Color(nsColor: hasVersion ? NSColor.secondaryLabelColor : NSColor.tertiaryLabelColor))
.lineLimit(1)
.numericTransition(value: item.displayVersion)
}
@@ -188,7 +188,7 @@ private struct CopyablePathText: View {
Text("common.status.copied")
.font(SettingsRowMetrics.captionFont)
- .foregroundStyle(.green)
+ .foregroundStyle(Color.green)
.lineLimit(1)
.opacity(isCopied ? 1 : 0)
}
diff --git a/CodexBar/Views/Settings/MainPanelOptionsView.swift b/CodexBar/Views/Settings/MainPanelOptionsView.swift
index 1f2e140..6992868 100644
--- a/CodexBar/Views/Settings/MainPanelOptionsView.swift
+++ b/CodexBar/Views/Settings/MainPanelOptionsView.swift
@@ -53,7 +53,7 @@ struct MainPanelOptionsView: View {
.frame(maxWidth: .infinity)
.liquidGlassSurface(cornerRadius: Metrics.draggedCornerRadius)
.shadow(
- color: .black.opacity(Metrics.draggedShadowOpacity),
+ color: Color.black.opacity(Metrics.draggedShadowOpacity),
radius: Metrics.draggedShadowRadius,
y: Metrics.draggedShadowY
)
diff --git a/CodexBar/Views/Settings/NotificationOptionsView.swift b/CodexBar/Views/Settings/NotificationOptionsView.swift
index 2d50cec..c9ce77c 100644
--- a/CodexBar/Views/Settings/NotificationOptionsView.swift
+++ b/CodexBar/Views/Settings/NotificationOptionsView.swift
@@ -251,7 +251,7 @@ struct NotificationOptionsView: View {
.frame(width: Metrics.statusIconSize, height: Metrics.statusIconSize)
} else if let errorMessage = tuiNotificationSettings.errorMessage {
Image(systemName: "exclamationmark.circle")
- .foregroundStyle(.orange)
+ .foregroundStyle(Color.orange)
.frame(width: Metrics.statusIconSize, height: Metrics.statusIconSize)
.help(errorMessage)
}
diff --git a/CodexBar/Views/Settings/PowerHelperInstallationStatusRow.swift b/CodexBar/Views/Settings/PowerHelperInstallationStatusRow.swift
index 2156018..8137770 100644
--- a/CodexBar/Views/Settings/PowerHelperInstallationStatusRow.swift
+++ b/CodexBar/Views/Settings/PowerHelperInstallationStatusRow.swift
@@ -24,13 +24,13 @@ struct PowerHelperInstallationStatusRow: View {
private var statusPresentation: (text: LocalizedStringKey, color: Color) {
switch status {
case .notInstalled:
- ("settings.about.power-helper.not-installed", .gray)
+ ("settings.about.power-helper.not-installed", Color.gray)
case .authorized:
- ("settings.about.power-helper.authorized", .green)
+ ("settings.about.power-helper.authorized", Color.green)
case .requiresApproval:
- ("settings.about.power-helper.requires-approval", .orange)
+ ("settings.about.power-helper.requires-approval", Color.orange)
case .unavailable:
- ("settings.about.power-helper.unavailable", .red)
+ ("settings.about.power-helper.unavailable", Color.red)
}
}
}
diff --git a/CodexBar/Views/Settings/RebuildDatePicker.swift b/CodexBar/Views/Settings/RebuildDatePicker.swift
index 6b66b4b..839ad47 100644
--- a/CodexBar/Views/Settings/RebuildDatePicker.swift
+++ b/CodexBar/Views/Settings/RebuildDatePicker.swift
@@ -63,7 +63,7 @@ struct RebuildDatePicker: View {
.frame(maxWidth: .infinity, minHeight: RebuildLayoutMetrics.controlHeight)
.background {
RoundedRectangle(cornerRadius: 7, style: .continuous)
- .fill(Color(nsColor: .controlBackgroundColor).opacity(0.72))
+ .fill(Color(nsColor: NSColor.controlBackgroundColor).opacity(0.72))
}
.overlay {
RoundedRectangle(cornerRadius: 7, style: .continuous)
@@ -72,7 +72,7 @@ struct RebuildDatePicker: View {
lineWidth: isPresented ? 1.2 : 0.8
)
}
- .shadow(color: .black.opacity(0.06), radius: 2, y: 1)
+ .shadow(color: Color.black.opacity(0.06), radius: 2, y: 1)
}
.buttonStyle(.plain)
.disabled(!isEnabled)
@@ -291,9 +291,9 @@ struct RebuildDatePicker: View {
isInCompletedRange: Bool
) -> Color {
if isEndpoint {
- return .accentColor
+ return Color.accentColor
}
- return isInCompletedRange ? Color.accentColor.opacity(0.16) : .clear
+ return isInCompletedRange ? Color.accentColor.opacity(0.16) : Color.clear
}
private func dayTextColor(
@@ -302,11 +302,11 @@ struct RebuildDatePicker: View {
isInDisplayedMonth: Bool
) -> Color {
if isEndpoint {
- return .white
+ return Color.white
}
if !isInDisplayedMonth {
- return .codexSecondaryLabel.opacity(isSelectable ? 0.58 : 0.24)
+ return Color.codexSecondaryLabel.opacity(isSelectable ? 0.58 : 0.24)
}
- return isSelectable ? .codexLabel : .codexSecondaryLabel.opacity(0.36)
+ return isSelectable ? Color.codexLabel : Color.codexSecondaryLabel.opacity(0.36)
}
}
diff --git a/CodexBar/Views/Settings/TaskGlowOptionsView.swift b/CodexBar/Views/Settings/TaskGlowOptionsView.swift
index 7cbe74c..ab2d21a 100644
--- a/CodexBar/Views/Settings/TaskGlowOptionsView.swift
+++ b/CodexBar/Views/Settings/TaskGlowOptionsView.swift
@@ -216,7 +216,7 @@ private struct TaskGlowColorHexField: View {
)
.overlay {
RoundedRectangle(cornerRadius: 5)
- .strokeBorder(isValid ? .clear : .red, lineWidth: 1)
+ .strokeBorder(isValid ? Color.clear : Color.red, lineWidth: 1)
.allowsHitTesting(false)
}
.fixedSize(horizontal: true, vertical: false)
diff --git a/CodexBar/Views/Shared/AppearanceTransition.swift b/CodexBar/Views/Shared/AppearanceTransition.swift
index 4745d0c..89bd99a 100644
--- a/CodexBar/Views/Shared/AppearanceTransition.swift
+++ b/CodexBar/Views/Shared/AppearanceTransition.swift
@@ -175,7 +175,7 @@ final class AppearanceTransition {
}
isReleasedWhenClosed = false
isOpaque = false
- backgroundColor = .clear
+ backgroundColor = NSColor.clear
hasShadow = false
ignoresMouseEvents = true
hidesOnDeactivate = false
diff --git a/CodexBar/Views/Shared/LiquidGlassStyle.swift b/CodexBar/Views/Shared/LiquidGlassStyle.swift
index fca2195..ff76d48 100644
--- a/CodexBar/Views/Shared/LiquidGlassStyle.swift
+++ b/CodexBar/Views/Shared/LiquidGlassStyle.swift
@@ -7,15 +7,16 @@ extension Animation {
static let codexStatus = Animation.easeInOut(duration: 0.20)
}
-/// 共享颜色和十六进制便捷初始化
+/// 共享语义色和 Display P3 十六进制初始化
extension Color {
// 某些自定义 View 需要具体 Color
// 不能直接使用 .primary/.secondary 这类 ShapeStyle
- static let codexLabel = Color(nsColor: .labelColor)
- static let codexSecondaryLabel = Color(nsColor: .secondaryLabelColor)
+ static let codexLabel = Color(nsColor: NSColor.labelColor)
+ static let codexSecondaryLabel = Color(nsColor: NSColor.secondaryLabelColor)
- nonisolated init(hex: Int) {
+ nonisolated init(displayP3Hex hex: Int) {
self.init(
+ .displayP3,
red: Double((hex >> 16) & 0xFF) / 255.0,
green: Double((hex >> 8) & 0xFF) / 255.0,
blue: Double(hex & 0xFF) / 255.0
@@ -25,11 +26,11 @@ extension Color {
/// 深色界面用背景明度区分层级, 强调色只用于数据和交互状态
enum CodexDarkPalette {
- static let background = Color(hex: 0x171B22)
- static let surface = Color(hex: 0x222832)
- static let raisedSurface = Color(hex: 0x2B3340)
- static let track = Color(hex: 0x394350)
- static let heatmap = Color(hex: 0x749DE0)
+ static let background = Color(displayP3Hex: 0x181B21)
+ static let surface = Color(displayP3Hex: 0x232831)
+ static let raisedSurface = Color(displayP3Hex: 0x2D333F)
+ static let track = Color(displayP3Hex: 0x3B434F)
+ static let heatmap = Color(displayP3Hex: 0x7D9CDB)
static let separator = Color.white.opacity(0.06)
static let outline = Color.white.opacity(0.08)
}
@@ -159,13 +160,13 @@ private struct SidePanelChrome: ViewModifier {
private var backingFill: Color {
colorScheme == .dark
? CodexDarkPalette.background
- : Color(nsColor: .windowBackgroundColor).opacity(0.86)
+ : Color(nsColor: NSColor.windowBackgroundColor).opacity(0.86)
}
private var boundaryColor: Color {
colorScheme == .dark
- ? .clear
- : .black.opacity(0.14)
+ ? Color.clear
+ : Color.black.opacity(0.14)
}
}
@@ -188,10 +189,10 @@ struct LiquidGlassDivider: View {
.mask {
LinearGradient(
stops: [
- .init(color: .clear, location: 0),
- .init(color: .white, location: 0.12),
- .init(color: .white, location: 0.88),
- .init(color: .clear, location: 1)
+ .init(color: Color.clear, location: 0),
+ .init(color: Color.white, location: 0.12),
+ .init(color: Color.white, location: 0.88),
+ .init(color: Color.clear, location: 1)
],
startPoint: .leading,
endPoint: .trailing
@@ -208,11 +209,11 @@ struct LiquidGlassDivider: View {
.fill(
LinearGradient(
colors: [
- .clear,
- Color(hex: 0x8799AE),
- Color(hex: 0xE3EBF4),
- Color(hex: 0xA9B9CB),
- .clear
+ Color.clear,
+ Color(displayP3Hex: 0x8A98AC),
+ Color(displayP3Hex: 0xE4EBF3),
+ Color(displayP3Hex: 0xACB8C9),
+ Color.clear
],
startPoint: UnitPoint(x: offset, y: 0.5),
endPoint: UnitPoint(x: 1 + offset, y: 0.5)
@@ -296,7 +297,7 @@ private struct LiquidGlassSurface: View {
shape.strokeBorder(CodexDarkPalette.outline, lineWidth: 0.5)
}
}
- .shadow(color: .black.opacity(isOuterSurface ? 0.24 : 0.10), radius: isOuterSurface ? 12 : 4, y: isOuterSurface ? 6 : 1)
+ .shadow(color: Color.black.opacity(isOuterSurface ? 0.24 : 0.10), radius: isOuterSurface ? 12 : 4, y: isOuterSurface ? 6 : 1)
} else {
ZStack {
shape
@@ -359,23 +360,23 @@ private struct LiquidGlassSurface: View {
}
private var highlightFill: Color {
- .white.opacity(isOuterSurface ? 0.12 : 0.14)
+ Color.white.opacity(isOuterSurface ? 0.12 : 0.14)
}
private var borderColor: Color {
- .white.opacity(isOuterSurface ? 0.34 : 0.28)
+ Color.white.opacity(isOuterSurface ? 0.34 : 0.28)
}
private var rimHighlightColor: Color {
- .white.opacity(isOuterSurface ? 0.36 : 0.50)
+ Color.white.opacity(isOuterSurface ? 0.36 : 0.50)
}
private var rimLightShadowColor: Color {
- .white.opacity(0.20)
+ Color.white.opacity(0.20)
}
private var rimDarkShadowColor: Color {
- .black.opacity(0.12)
+ Color.black.opacity(0.12)
}
private var rimLineWidth: CGFloat {
@@ -384,24 +385,24 @@ private struct LiquidGlassSurface: View {
private var baseColor: Color {
isOuterSurface
- ? Color(red: 0.97, green: 0.985, blue: 1.0)
+ ? Color(displayP3Hex: 0xF8FBFF)
: Color.white
}
private var raisedHighlightShadowColor: Color {
- .white.opacity(0.46)
+ Color.white.opacity(0.46)
}
private var ambientShadowColor: Color {
if isOuterSurface {
- return .black.opacity(0.16)
+ return Color.black.opacity(0.16)
}
- return .black.opacity(0.18)
+ return Color.black.opacity(0.18)
}
private var contactShadowColor: Color {
- .black.opacity(0.08)
+ Color.black.opacity(0.08)
}
}
@@ -447,8 +448,8 @@ private struct LiquidGlassFrostedTexture: View {
for bucket in 0 ..< Self.bucketCount {
let strength = (Double(bucket) + 0.5) / Double(Self.bucketCount)
let opacity = baseOpacity * strength * outerScale
- context.fill(highlightPaths[bucket], with: .color(.white.opacity(opacity)))
- context.fill(shadowPaths[bucket], with: .color(.black.opacity(opacity * shadowFactor)))
+ context.fill(highlightPaths[bucket], with: .color(Color.white.opacity(opacity)))
+ context.fill(shadowPaths[bucket], with: .color(Color.black.opacity(opacity * shadowFactor)))
}
}
.allowsHitTesting(false)
@@ -512,7 +513,7 @@ private struct LiquidGlassBadge<S: InsettableShape>: View {
}
private var fillColor: Color {
- Color(red: 0.94, green: 0.96, blue: 0.98)
+ Color(displayP3Hex: 0xF1F5F9)
}
private var borderColor: Color {
@@ -520,11 +521,11 @@ private struct LiquidGlassBadge<S: InsettableShape>: View {
}
private var innerRimColor: Color {
- .white.opacity(0.42)
+ Color.white.opacity(0.42)
}
private var topHighlightColor: Color {
- .white.opacity(0.30)
+ Color.white.opacity(0.30)
}
}
@@ -537,11 +538,11 @@ private struct LiquidGlassSpecular: View {
.strokeBorder(
AngularGradient(
colors: [
- .white.opacity(0.52),
- .white.opacity(0.04),
- .white.opacity(0.18),
- .clear,
- .white.opacity(0.42)
+ Color.white.opacity(0.52),
+ Color.white.opacity(0.04),
+ Color.white.opacity(0.18),
+ Color.clear,
+ Color.white.opacity(0.42)
],
center: .center,
startAngle: .degrees(215),
diff --git a/CodexBar/Views/Shared/QuotaPalette.swift b/CodexBar/Views/Shared/QuotaPalette.swift
index ba05dad..82b2279 100644
--- a/CodexBar/Views/Shared/QuotaPalette.swift
+++ b/CodexBar/Views/Shared/QuotaPalette.swift
@@ -1,18 +1,18 @@
import SwiftUI
-/// 额度颜色按剩余百分比分档, 菜单栏图标与面板额度条共用同一套阈值和色值
+/// Display P3 额度颜色按剩余百分比分档, 菜单栏图标与面板额度条共用同一套阈值和色值
nonisolated enum QuotaPalette {
static let tiers: [(lowerBound: Int, hex: Int)] = [
- (0, 0xE8605B),
- (10, 0xF57349),
- (20, 0xFD8733),
- (30, 0xFD9A10),
- (40, 0xF2AA06),
- (50, 0xE0B503),
- (60, 0xC7BB06),
- (70, 0xA5BC1A),
- (80, 0x7CB939),
- (90, 0x46B250)
+ (0, 0xD86960),
+ (10, 0xE57A54),
+ (20, 0xED8D48),
+ (30, 0xEF9F3C),
+ (40, 0xE7AD3C),
+ (50, 0xD9B73D),
+ (60, 0xBBBE4D),
+ (70, 0x99C266),
+ (80, 0x79C282),
+ (90, 0x5DBE9C)
]
static func hex(for percent: Int) -> Int {
@@ -20,6 +20,6 @@ nonisolated enum QuotaPalette {
}
static func color(for percent: Int) -> Color {
- Color(hex: hex(for: percent))
+ Color(displayP3Hex: hex(for: percent))
}
}
diff --git a/CodexBar/Views/Shared/TaskGlowView.swift b/CodexBar/Views/Shared/TaskGlowView.swift
index 2a7eb46..3f08184 100644
--- a/CodexBar/Views/Shared/TaskGlowView.swift
+++ b/CodexBar/Views/Shared/TaskGlowView.swift
@@ -57,7 +57,7 @@ final class TaskGlowPanel: NSPanel {
super.init(contentRect: geometry.frame, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)
isReleasedWhenClosed = false
isOpaque = false
- backgroundColor = .clear
+ backgroundColor = NSColor.clear
hasShadow = false
ignoresMouseEvents = true
hidesOnDeactivate = false
@@ -400,7 +400,7 @@ final class TaskGlowView: NSView {
let position = (Double(depth) + 0.5) / Double(Self.segmentsPerSide)
let intensity = pow(sin(position * .pi / 2), 2)
let color = glowAppearance.color(for: .running)
- let tint = color.blended(withFraction: pow(intensity, 8) * 0.8, of: .white) ?? color
+ let tint = color.blended(withFraction: pow(intensity, 8) * 0.8, of: NSColor.white) ?? color
segment.strokeColor = tint.withAlphaComponent((intensity - previousIntensity) / (1 - previousIntensity)).cgColor
previousIntensity = intensity
let tailLength = span * (1 - Double(depth) / Double(Self.segmentsPerSide))
diff --git a/Config/BuildNumber.xcconfig b/Config/BuildNumber.xcconfig
index f90879c..475d9f4 100644
--- a/Config/BuildNumber.xcconfig
+++ b/Config/BuildNumber.xcconfig
@@ -1,3 +1,3 @@
// 请勿手动修改
// Do not modify manually
-CURRENT_PROJECT_VERSION = 385
\ No newline at end of file
+CURRENT_PROJECT_VERSION = 395
\ No newline at end of file
diff --git a/Config/Version.xcconfig b/Config/Version.xcconfig
index 802c96d..3b33dba 100644
--- a/Config/Version.xcconfig
+++ b/Config/Version.xcconfig
@@ -1,2 +1,2 @@
#include "BuildNumber.xcconfig"
-MARKETING_VERSION = 5.2.2
+MARKETING_VERSION = 5.2.3
diff --git a/appcast.xml b/appcast.xml
index adf864f..e63baac 100644
--- a/appcast.xml
+++ b/appcast.xml
@@ -5,6 +5,20 @@
<link>https://codexbar.zabrian.app/appcast.xml</link>
<description>CodexBar appcast feed</description>
<language>zh-CN</language>
+ <item>
+ <title>CodexBar 5.2.3</title>
+ <sparkle:version>395</sparkle:version>
+ <sparkle:shortVersionString>5.2.3</sparkle:shortVersionString>
+ <sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
+ <sparkle:minimumAutoupdateVersion>200</sparkle:minimumAutoupdateVersion>
+ <sparkle:informationalUpdate><sparkle:belowVersion>200</sparkle:belowVersion></sparkle:informationalUpdate>
+ <link xml:lang="en-US">https://codexbar.zabrian.app/notes?lang=en-US#5.0.0-Guide</link>
+ <link xml:lang="zh-CN">https://codexbar.zabrian.app/notes?lang=zh-CN#5.0.0-Guide</link>
+ <sparkle:releaseNotesLink xml:lang="en-US">https://codexbar.zabrian.app/notes?lang=en-US#5.2.3</sparkle:releaseNotesLink>
+ <sparkle:releaseNotesLink xml:lang="zh-CN">https://codexbar.zabrian.app/notes?lang=zh-CN#5.2.3</sparkle:releaseNotesLink>
+ <pubDate>Fri, 06 Nov 2026 11:57:48 +0800</pubDate>
+ <enclosure url="https://codexbar.zabrian.app/download/CodexBar-v5.2.3.dmg" sparkle:edSignature="9UnstwPzL9h0oWHTvSJJ1nBUtrRU/4EZlIiX2/v/FJUqAAT3ycFbFMng70ar+RFWyjNRW3tfqyf46ceSpbLzBg==" length="11452416" type="application/octet-stream"/>
+ </item>
<item>
<title>CodexBar 5.2.2</title>
<sparkle:version>381</sparkle:version>