mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
5ad97132b8
- Replace custom Observable protocol and @Published with Apple's @Observable macro - Add withObservationTracking in renderToBuffer for automatic per-property dependency tracking - Add type-based @Environment(Type.self) and .environment(object) for observable objects - Add ObjectEnvironmentModifier for injecting observable objects into the environment - Add needsCacheClear flag to AppState for thread-safe cache invalidation - Add cross-platform test script (scripts/test-linux.sh) for Docker-based Linux verification - Add DemoAppHeader with system info display (OS, version, architecture) - Consolidate Example App: extract ImageDemoHelpers, KeyboardHelpSection, ValueDisplayRow - Add pre-push verification rule to CLAUDE.md - Verified on both macOS and Linux (swift:6.0 container), 1155 tests passing
69 lines
2.3 KiB
Swift
69 lines
2.3 KiB
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
||
// ColorsPage.swift
|
||
//
|
||
// Created by LAYERED.work
|
||
// License: MIT
|
||
|
||
import TUIkit
|
||
|
||
/// Colors demo page.
|
||
///
|
||
/// Shows various color options including:
|
||
/// - Standard ANSI colors (8 colors)
|
||
/// - Bright colors (8 colors)
|
||
/// - RGB colors (24-bit true color)
|
||
/// - Semantic colors (primary, success, warning, error)
|
||
struct ColorsPage: View {
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 1) {
|
||
|
||
DemoSection("Standard ANSI Colors") {
|
||
HStack(spacing: 2) {
|
||
Text("Black").foregroundStyle(.black).background(.white)
|
||
Text("Red").foregroundStyle(.red)
|
||
Text("Green").foregroundStyle(.green)
|
||
Text("Yellow").foregroundStyle(.yellow)
|
||
}
|
||
HStack(spacing: 2) {
|
||
Text("Blue").foregroundStyle(.blue)
|
||
Text("Magenta").foregroundStyle(.magenta)
|
||
Text("Cyan").foregroundStyle(.cyan)
|
||
Text("White").foregroundStyle(.white)
|
||
}
|
||
}
|
||
|
||
DemoSection("Bright Colors") {
|
||
HStack(spacing: 2) {
|
||
Text("Bright Red").foregroundStyle(.brightRed)
|
||
Text("Bright Green").foregroundStyle(.brightGreen)
|
||
Text("Bright Yellow").foregroundStyle(.brightYellow)
|
||
Text("Bright Blue").foregroundStyle(.brightBlue)
|
||
}
|
||
}
|
||
|
||
DemoSection("RGB Colors (24-bit)") {
|
||
HStack(spacing: 2) {
|
||
Text("Orange").foregroundStyle(.rgb(255, 128, 0))
|
||
Text("Pink").foregroundStyle(.rgb(255, 105, 180))
|
||
Text("Teal").foregroundStyle(.rgb(0, 128, 128))
|
||
Text("Purple").foregroundStyle(.rgb(128, 0, 128))
|
||
}
|
||
}
|
||
|
||
DemoSection("Semantic Colors") {
|
||
HStack(spacing: 2) {
|
||
Text("Primary").foregroundStyle(.primary)
|
||
Text("Success").foregroundStyle(.success)
|
||
Text("Warning").foregroundStyle(.warning)
|
||
Text("Error").foregroundStyle(.error)
|
||
}
|
||
}
|
||
|
||
Spacer()
|
||
}
|
||
.appHeader {
|
||
DemoAppHeader("Colors Demo")
|
||
}
|
||
}
|
||
}
|