mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
BREAKING CHANGE: Package name changed due to name collision with existing rensbreur/SwiftTUI package. Changes: - Rename package from SwiftTUI to TUIKit in Package.swift - Rename Sources/SwiftTUI to Sources/TUIKit - Rename Sources/SwiftTUIExample to Sources/TUIKitExample - Rename Tests/SwiftTUITests to Tests/TUIKitTests - Rename SwiftTUI.swift to TUIKit.swift - Update all imports: import SwiftTUI -> import TUIKit - Update all code references: SwiftTUI.renderToBuffer -> TUIKit.renderToBuffer - Update documentation comments - Rename swiftTUIVersion to tuiKitVersion All 181 tests passing.
68 lines
2.3 KiB
Swift
68 lines
2.3 KiB
Swift
//
|
|
// ColorsPage.swift
|
|
// TUIKitExample
|
|
//
|
|
// Demonstrates color capabilities.
|
|
//
|
|
|
|
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) {
|
|
HeaderView(title: "Colors Demo")
|
|
|
|
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()
|
|
}
|
|
}
|
|
}
|