@@ -18,26 +18,12 @@ public override Visual Build(DemoContext context)
1818 {
1919 _ = context ;
2020
21- var banner = new TextFiglet ( "Welcome" )
22- . Font ( FigletPredefinedFont . Slant )
23- . LetterSpacing ( 1 )
24- . TextAlignment ( TextAlignment . Left ) ;
25-
26- var title = new Markup ( "[bold]XenoAtom.Terminal.UI[/]" ) { Wrap = false } ;
27-
28- var hints = new Markup ( """
29- [bold]Tips[/]
30- - Use the [bold]Search[/] box to filter controls and demos.
31- - Use [bold]Tab[/] to move focus and [bold]Mouse wheel[/] to scroll lists.
32- - Use [bold]Ctrl+Q[/] to quit.
33- """ )
34- { Wrap = true } ;
21+ var theme = context . Theme . Value ;
3522
3623 var spectrum = new Canvas ( )
3724 . MinHeight ( 6 )
3825 . Painter ( ctx =>
3926 {
40- var theme = DemoThemes . Dark ;
4127 var baseStyle = theme . BaseTextStyle ( ) ;
4228 var width = Math . Max ( 1 , ctx . Bounds . Width ) ;
4329 var height = Math . Max ( 1 , ctx . Bounds . Height ) ;
@@ -63,18 +49,31 @@ public override Visual Build(DemoContext context)
6349 }
6450 } ) . HorizontalAlignment ( HorizontalAlignment . Stretch ) . VerticalAlignment ( VerticalAlignment . Stretch ) ;
6551
52+ var banner = new TextFiglet ( "Welcome" )
53+ . Font ( FigletPredefinedFont . Slant )
54+ . LetterSpacing ( 1 )
55+ . TextAlignment ( TextAlignment . Left ) ;
56+ //.Style(new TextFigletStyle { TextStyle = Style.None.WithForeground(theme.Scheme?.Black ?? Colors.Black) | TextStyle.Bold });
57+
58+ var title = new Markup ( "[bold]XenoAtom.Terminal.UI[/]" ) { Wrap = false } ;
59+
60+ var hints = new Markup ( """
61+ [bold]Tips[/]
62+ - Use the [bold]Search[/] box to filter controls and demos.
63+ - Use [bold]Tab[/] to move focus and [bold]Mouse wheel[/] to scroll lists.
64+ - Use [bold]Ctrl+Q[/] to quit.
65+ """ )
66+ { Wrap = true } ;
67+
68+
6669 var schemePanel = BuildSchemePanel ( DemoThemes . Dark ) ;
6770
6871 return new VStack (
69- banner ,
72+ new ZStack ( spectrum , banner ) ,
7073 title ,
7174 new Rule ( ) ,
7275 hints ,
7376 new Rule ( ) ,
74- new Group ( )
75- . TopLeftText ( "Spectrum" )
76- . Padding ( 1 )
77- . Content ( spectrum ) . VerticalAlignment ( VerticalAlignment . Stretch ) . HorizontalAlignment ( HorizontalAlignment . Stretch ) ,
7877 schemePanel )
7978 . Spacing ( 1 ) ;
8079 }
@@ -84,7 +83,7 @@ private static Visual BuildSchemePanel(Theme theme)
8483 var scheme = theme . Scheme ;
8584 if ( scheme is null )
8685 {
87- return ( Visual ) "[dim]No ColorScheme available for this theme.[/]" ;
86+ return "[dim]No ColorScheme available for this theme.[/]" ;
8887 }
8988
9089 var table = new Table ( )
@@ -126,29 +125,7 @@ void Add(string name, Color? color)
126125 private static Visual CreateSwatch ( Theme theme , Color ? color )
127126 {
128127 const int width = 10 ;
129- const int height = 1 ;
130-
131- return new Canvas ( )
132- . MinWidth ( width )
133- . MaxWidth ( width )
134- . MinHeight ( height )
135- . MaxHeight ( height )
136- . Painter ( ctx =>
137- {
138- var style = theme . BaseTextStyle ( ) ;
139- if ( color is { } c && c . Kind != ColorKind . Default )
140- {
141- style = style . WithBackground ( c ) ;
142- }
143-
144- for ( var y = 0 ; y < ctx . Bounds . Height ; y ++ )
145- {
146- for ( var x = 0 ; x < ctx . Bounds . Width ; x ++ )
147- {
148- ctx . SetPixel ( x , y , new Rune ( ' ' ) , style ) ;
149- }
150- }
151- } ) ;
128+ return new TextBlock ( new string ( ' ' , width ) ) . Style ( TextBlockStyle . Default with { Background = color } ) ;
152129 }
153130
154131 private static string FormatColor ( Color ? color )
0 commit comments