spectre-kit

A Swift framework that makes it easier to create beautiful console applications.

MIT License

Stars
86
Committers
2

SpectreKit

A Swift library that makes it easier to create beautiful terminal applications.

It is a port of Spectre.Console which in turn is heavily inspired by the excellent Python library, Rich.

[!NOTE] SpectreKit is currently under development, and many things are still missing.

Example

import SpectreKit

console.write(
    Panel(
        Table()
            .addColumns("Foo", "[green]Bar[/]", "Baz")
            .addRow(Markup("[red]abc[/]"), Text("def"), Markup("[yellow]lol[/]"))
            .addRow(
                Markup("[green bold]Corgi[/]"), Text("jkl"),
                Table()
                    .addColumn("Foo")
                    .addColumn("Bar")
                    .addColumn("Baz")
                    .addRow(Markup("[red]abc[/]"), Text("def"), Markup("[yellow]lol[/]"))
                    .addRow(Markup("[green bold]Corgi[/]"), Text("jkl"), Markup("[blue]wtf[/]"))
                    .setBorder(TableBorder.doubleEdge)
                    .setTitle("A table in a table in a panel")
                    .setCaption("A [blue]caption[/]")
            )
            .setTitle("A table in a panel")
            .setBorder(TableBorder.rounded)
    )
    .setHeader("[white]A panel[/]")
    .setBorderColor(Color.rgb(128, 128, 0)))