Files
TUIkit/Sources/TUIkitExample/Pages/ColorsPage.swift
T
phranck d3f8ff60f3 Chore: Change license to MIT
- Add LICENSE file (MIT)
- Update 141 Swift file headers: CC BY-NC-SA 4.0 → License: MIT
2026-02-06 00:21:51 +01:00

73 lines
2.5 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(spacing: 1) {
DemoSection("Standard ANSI Colors") {
HStack(spacing: 2) {
Text("Black").foregroundColor(.black).background(.white)
Text("Red").foregroundColor(.red)
Text("Green").foregroundColor(.green)
Text("Yellow").foregroundColor(.yellow)
}
HStack(spacing: 2) {
Text("Blue").foregroundColor(.blue)
Text("Magenta").foregroundColor(.magenta)
Text("Cyan").foregroundColor(.cyan)
Text("White").foregroundColor(.white)
}
}
DemoSection("Bright Colors") {
HStack(spacing: 2) {
Text("Bright Red").foregroundColor(.brightRed)
Text("Bright Green").foregroundColor(.brightGreen)
Text("Bright Yellow").foregroundColor(.brightYellow)
Text("Bright Blue").foregroundColor(.brightBlue)
}
}
DemoSection("RGB Colors (24-bit)") {
HStack(spacing: 2) {
Text("Orange").foregroundColor(.rgb(255, 128, 0))
Text("Pink").foregroundColor(.rgb(255, 105, 180))
Text("Teal").foregroundColor(.rgb(0, 128, 128))
Text("Purple").foregroundColor(.rgb(128, 0, 128))
}
}
DemoSection("Semantic Colors") {
HStack(spacing: 2) {
Text("Primary").foregroundColor(.primary)
Text("Success").foregroundColor(.success)
Text("Warning").foregroundColor(.warning)
Text("Error").foregroundColor(.error)
}
}
Spacer()
}
.appHeader {
HStack {
Text("Colors Demo").bold().foregroundColor(.palette.accent)
Spacer()
Text("TUIkit v\(tuiKitVersion)").foregroundColor(.palette.foregroundTertiary)
}
}
}
}