Files
phranck 5ad97132b8 Feat: Add @Observable support with Observation framework
- 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
2026-02-15 23:49:34 +01:00

69 lines
2.3 KiB
Swift
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 🖥 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")
}
}
}