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
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "AgentKit",
platforms: [
.macOS(.v15),
.iOS(.v18),
.macOS(.v26),
.iOS(.v26),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ extension TextOutputFormat {
fileprivate init(theme: Splash.Theme) {
var theme = theme

#if canImport(UIKit)
theme.plainTextColor = .label
#elseif canImport(AppKit)
theme.plainTextColor = .textColor
#endif
theme.tokenColors[.keyword] = .blue
theme.tokenColors[.string] = .blue
theme.tokenColors[.comment] = .gray
Expand All @@ -52,14 +56,28 @@ extension TextOutputFormat {
}

mutating func addToken(_ token: String, ofType type: TokenType) {
#if canImport(UIKit)
let color = self.theme.tokenColors[type] ?? .label
#elseif canImport(AppKit)
let color = self.theme.tokenColors[type] ?? .textColor
#endif
#if canImport(UIKit)
self.accumulatedText.append(Text(token).foregroundColor(.init(uiColor: color)))
#elseif canImport(AppKit)
self.accumulatedText.append(Text(token).foregroundColor(.init(nsColor: color)))
#endif
}

mutating func addPlainText(_ text: String) {
#if canImport(UIKit)
self.accumulatedText.append(
Text(text).foregroundColor(.init(uiColor: self.theme.plainTextColor))
)
#elseif canImport(AppKit)
self.accumulatedText.append(
Text(text).foregroundColor(.init(nsColor: self.theme.plainTextColor))
)
#endif
}

mutating func addWhitespace(_ whitespace: String) {
Expand Down
Loading