nigig-org/crates/apps/theming/splash/theme_gallery.splash
2026-07-26 19:38:26 +03:00

115 lines
3.5 KiB
Text

// Standalone Makepad 2.0 Splash script.
//
// This file mirrors the theme tokens defined in Rust (src/streem_theme/)
// so you can see the same palette used from pure Splash — without the
// Rust host. Load it in Makepad Studio's splash runner, or paste the body
// into a `runsplash` block in aichat.
//
// The colors below are the dark palette from src/streem_theme/mod.rs.
// To preview a different palette, swap the hex values. (A future
// improvement would be to have the Rust host inject
// `mod.streem_theme.s_themes` into the splash VM so this file could
// reference `color_bg` etc. directly — but for a standalone script we
// spell them out.)
use mod.prelude.widgets.*
// ── Reusable card ──────────────────────────────────────────────────────
// Mirrors the DemoCard template in src/main.rs.
let SwatchCard = RoundedView{
width: Fill height: Fit
flow: Down spacing: 8
padding: 14
new_batch: true
draw_bg.color: #x1E293B
draw_bg.border_radius: 8.0
title := Label{
text: "Section"
draw_text.color: #x38BDF8
draw_text.text_style.font_size: 14
}
body := Label{
text: ""
draw_text.color: #xE2E8F0
draw_text.text_style.font_size: 11
}
}
// ── Layout ─────────────────────────────────────────────────────────────
RoundedView{
width: Fill height: Fit
flow: Down spacing: 12
padding: 18
new_batch: true
draw_bg.color: #0F172A
draw_bg.border_radius: 12.0
Label{
text: "Theme Gallery (Splash)"
draw_text.color: #x38BDF8
draw_text.text_style.font_size: 18
}
Label{
text: "Same tokens as the Rust demo — pure Splash, no host."
draw_text.color: #x94A3B8
draw_text.text_style.font_size: 10
}
Hr{}
// Color swatches row — shows the four core dark palette colors.
View{
width: Fill height: Fit
flow: Right spacing: 8
SolidView{
width: Fill height: 40
draw_bg.color: #0F172A
Label{text: "bg" draw_text.color: #xE2E8F0 draw_text.text_style.font_size: 9}
}
SolidView{
width: Fill height: 40
draw_bg.color: #x1E293B
Label{text: "surface" draw_text.color: #xE2E8F0 draw_text.text_style.font_size: 9}
}
SolidView{
width: Fill height: 40
draw_bg.color: #x38BDF8
Label{text: "primary" draw_text.color: #fff draw_text.text_style.font_size: 9}
}
}
// Sample cards
SwatchCard{
title.text: "Card 1"
body.text: "The quick brown fox jumps over the lazy dog."
}
SwatchCard{
title.text: "Card 2"
body.text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
}
// Buttons row
View{
width: Fill height: Fit
flow: Right spacing: 8
Button{text: "Primary"}
ButtonFlat{text: "Secondary"}
ButtonFlatter{text: "Ghost"}
}
// Inputs row
TextInput{
width: Fill height: Fit
empty_text: "Type here..."
}
DropDown{labels: ["Option A" "Option B" "Option C"]}
// Slider
Slider{width: Fill text: "Volume" min: 0.0 max: 100.0 default: 50.0}
// Checkbox
CheckBox{text: "Enable feature"}
}