diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8a5cea8..f80e82f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,6 +6,8 @@ on: - '*' branches: - main + paths: + - 'src/**' env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true diff --git a/docs/Preview.ps1 b/docs/Preview.ps1 new file mode 100644 index 0000000..6f4f896 --- /dev/null +++ b/docs/Preview.ps1 @@ -0,0 +1 @@ +dotnet run -- preview --virtual-dir "spectre.console" \ No newline at end of file diff --git a/docs/input/assets/images/helloworld.png b/docs/input/assets/images/helloworld.png new file mode 100644 index 0000000..24a440c Binary files /dev/null and b/docs/input/assets/images/helloworld.png differ diff --git a/docs/input/docs/colors.md b/docs/input/docs/colors.md index 21fd419..6d52ab1 100644 --- a/docs/input/docs/colors.md +++ b/docs/input/docs/colors.md @@ -1,5 +1,5 @@ Title: Colors -Order: 2 +Order: 4 --- The following is a list of the standard 8-bit colors supported in terminals. diff --git a/docs/input/docs/markup.md b/docs/input/docs/markup.md new file mode 100644 index 0000000..93ceae8 --- /dev/null +++ b/docs/input/docs/markup.md @@ -0,0 +1,95 @@ +Title: Markup +Order: 3 +Hidden: False +--- + +In `Spectre.Console` there's a class called `Markup` that +allows you to output rich text to the console. + +```csharp +AnsiConsole.Render(new Markup("[bold yellow]Hello[/] [red]World![/]")); +``` + +Which should output something similar to the image below. Note that the +actual appearance might vary depending on your terminal. + +![](/spectre.console/assets/images/helloworld.png) + + +The `Markup` class implements `IRenderable` which means that you +can use this in tables, grids, and panels. Most classes that support +rendering of `IRenderable` also have overloads for rendering rich text. + +```csharp +var table = new Table(); +table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]"))); +table.AddColumn(new TableColumn("[blue]Bar[/]")); +``` + +# Convenience methods + +There is also convenience methods on `AnsiConsole` that can be used +to write markup text to the console without instantiating a new `Markup` +instance. + +```csharp +AnsiConsole.Markup("[underline green]Hello[/] "); +AnsiConsole.MarkupLine("[bold]World[/]"); +``` + +# Setting background color + +You can set the background color in markup by prefixing the color with +`on`. + +``` +[bold yellow on blue]Hello[/] +[default on blue]World[/] +``` + +# Colors + +For a list of colors, see the [Colors](xref:colors) section. + +# Styles + +Note that what styles that can be used is defined by the system or your terminal software, and may not appear as they should. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
boldBold text
dimDim or faint text
italicItalic text
underlineUnderlined text
invertSwaps the foreground and background colors
concealHides the text
slowblinkMakes text blink slowly
rapidblinkMakes text blink
strikethroughShows text with a horizontal line through the center
\ No newline at end of file