Files
TUIkit/Sources/TUIkitExample/Pages/TextStylesPage.swift
T
phranck df4ee3253b Feat: AppHeader — framework-managed header bar rendered outside the view tree
AppHeader is rendered at the top of the terminal by RenderLoop, similar to
StatusBar at the bottom. Views declare header content via .appHeader { }
ViewBuilder modifier. Supports standard (thin divider) and block (half-block
with appHeaderBackground) appearance. Hidden when no content is set.
Diff cache invalidates on header height changes to prevent ghosting.
2026-02-03 21:21:41 +01:00

51 lines
1.6 KiB
Swift
Raw 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
// TextStylesPage.swift
//
// Created by LAYERED.work
// CC BY-NC-SA 4.0
import TUIkit
/// Text styles demo page.
///
/// Shows various text styling options including:
/// - Basic styles (bold, italic, underline, etc.)
/// - Combined styles
/// - Special effects (blink, inverted)
struct TextStylesPage: View {
var body: some View {
VStack(spacing: 1) {
DemoSection("Basic Styles") {
Text("Normal text - no styling applied")
Text("Bold text").bold()
Text("Italic text").italic()
Text("Underlined text").underline()
Text("Strikethrough text").strikethrough()
Text("Dimmed text").dim()
}
DemoSection("Combined Styles") {
Text("Bold + Italic").bold().italic()
Text("Bold + Underline").bold().underline()
Text("Bold + Color").bold().foregroundColor(.palette.accent)
Text("Italic + Dim").italic().dim()
Text("All combined").bold().italic().underline().foregroundColor(.palette.accent)
}
DemoSection("Special Effects") {
Text("Blinking text (if terminal supports)").blink()
Text("Inverted colors").inverted()
}
Spacer()
}
.appHeader {
HStack {
Text("Text Styles Demo").bold().foregroundColor(.palette.accent)
Spacer()
Text("TUIkit v\(tuiKitVersion)").foregroundColor(.palette.foregroundTertiary)
}
}
}
}