mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
New doc theme (#387)
This commit is contained in:
@ -4,11 +4,11 @@ Order: 20
|
||||
|
||||
Use `BarChart` to render bar charts to the console.
|
||||
|
||||
<img src="../assets/images/barchart.png" style="width: 100%;" />
|
||||

|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
## Basic usage
|
||||
### Basic usage
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Render(new BarChart()
|
||||
@ -20,7 +20,7 @@ AnsiConsole.Render(new BarChart()
|
||||
.AddItem("Banana", 33, Color.Red));
|
||||
```
|
||||
|
||||
## Add items with converter
|
||||
### Add items with converter
|
||||
|
||||
```csharp
|
||||
// Create a list of fruits
|
||||
@ -40,7 +40,7 @@ AnsiConsole.Render(new BarChart()
|
||||
item.Label, item.Value, Color.Yellow)));
|
||||
```
|
||||
|
||||
## Add items implementing IBarChartItem
|
||||
### Add items implementing IBarChartItem
|
||||
|
||||
```csharp
|
||||
public sealed class Fruit : IBarChartItem
|
||||
@ -72,4 +72,4 @@ AnsiConsole.Render(new BarChart()
|
||||
.CenterLabel()
|
||||
.AddItem(new Fruit("Mango", 3))
|
||||
.AddItems(items));
|
||||
```
|
||||
```
|
||||
|
@ -5,7 +5,7 @@ RedirectFrom: calendar
|
||||
|
||||
The `Calendar` is used to render a calendar to the terminal.
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
To render a calendar, create a `Calendar` instance with a target date.
|
||||
|
||||
@ -109,7 +109,7 @@ AnsiConsole.Render(calendar);
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
```
|
||||
|
||||
### Highlight style
|
||||
## Highlight style
|
||||
|
||||
You can set the highlight style for a calendar event via `SetHighlightStyle`.
|
||||
|
||||
|
@ -10,7 +10,7 @@ the [Spectre.Console.ImageSharp](https://www.nuget.org/packages/Spectre.Console.
|
||||
> dotnet add package Spectre.Console.ImageSharp
|
||||
```
|
||||
|
||||
# Loading images
|
||||
## Loading images
|
||||
|
||||
Once you've added the `Spectre.Console.ImageSharp` NuGet package,
|
||||
you can create a new instance of `CanvasImage` to draw images to the console.
|
||||
|
@ -6,7 +6,7 @@ Order: 60
|
||||
(or _coxels_, as [Simon Cropp](https://twitter.com/SimonCropp/status/1331554791726534657?s=20)
|
||||
suggested we should call them).
|
||||
|
||||
# Drawing primitives
|
||||
## Drawing primitives
|
||||
|
||||
```csharp
|
||||
// Create a canvas
|
||||
@ -49,4 +49,4 @@ AnsiConsole.Render(canvas);
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #0000FF"> </span><span style="background-color: #FFFF00"> </span>
|
||||
</pre>
|
||||
</pre>
|
||||
|
@ -5,7 +5,7 @@ RedirectFrom: figlet
|
||||
|
||||
Spectre.Console can render [FIGlet](http://www.figlet.org/) text by using the `FigletText` class.
|
||||
|
||||
# Default font
|
||||
## Default font
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Render(
|
||||
@ -22,7 +22,7 @@ AnsiConsole.Render(
|
||||
|_| |_| \___| |_| |_| \___/
|
||||
```
|
||||
|
||||
# Custom font
|
||||
## Custom font
|
||||
|
||||
```csharp
|
||||
var font = FigletFont.Load("starwars.flf");
|
||||
@ -31,4 +31,4 @@ AnsiConsole.Render(
|
||||
new FigletText(font, "Hello")
|
||||
.LeftAligned()
|
||||
.Color(Color.Red));
|
||||
```
|
||||
```
|
||||
|
@ -2,8 +2,6 @@ Title: Widgets
|
||||
Order: 9
|
||||
---
|
||||
|
||||
<h1>Sections</h1>
|
||||
|
||||
<ul>
|
||||
@foreach (IDocument child in OutputPages.GetChildrenOf(Document))
|
||||
{
|
||||
|
@ -5,9 +5,9 @@ RedirectFrom: rule
|
||||
|
||||
The `Rule` class is used to render a horizontal rule (line) to the terminal.
|
||||
|
||||
<img src="../assets/images/rule.png" style="width: 100%;" />
|
||||

|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
To render a rule without a title:
|
||||
|
||||
@ -29,7 +29,7 @@ AnsiConsole.Render(rule);
|
||||
───────────────────────────────── Hello ─────────────────────────────────
|
||||
```
|
||||
|
||||
### Title alignment
|
||||
## Title alignment
|
||||
|
||||
You can set the rule's title alignment.
|
||||
|
||||
|
@ -9,7 +9,7 @@ Tables are a perfect way of displaying tabular data in a terminal.
|
||||
all columns to fit whatever is inside them. Anything that implements
|
||||
`IRenderable` can be used as a column header or column cell, even another table!
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
<!------------------------->
|
||||
<!--- USAGE --->
|
||||
@ -39,13 +39,13 @@ This will render the following output:
|
||||
|
||||

|
||||
|
||||
# Table appearance
|
||||
## Table appearance
|
||||
|
||||
<!------------------------->
|
||||
<!--- TABLE APPEARANCE --->
|
||||
<!------------------------->
|
||||
|
||||
## Borders
|
||||
### Borders
|
||||
|
||||
For a list of borders, see the [Borders](xref:borders) appendix section.
|
||||
|
||||
@ -57,7 +57,7 @@ table.Border(TableBorder.Square);
|
||||
table.Border(TableBorder.Rounded);
|
||||
```
|
||||
|
||||
## Expand / Collapse
|
||||
### Expand / Collapse
|
||||
|
||||
```csharp
|
||||
// Table will take up as much space as it can
|
||||
@ -68,21 +68,21 @@ table.Expand();
|
||||
table.Collapse();
|
||||
```
|
||||
|
||||
## Hide headers
|
||||
### Hide headers
|
||||
|
||||
```csharp
|
||||
// Hides all column headers
|
||||
table.HideHeaders();
|
||||
```
|
||||
|
||||
## Set table width
|
||||
### Set table width
|
||||
|
||||
```csharp
|
||||
// Sets the table width to 50 cells
|
||||
table.Width(50);
|
||||
```
|
||||
|
||||
## Alignment
|
||||
### Alignment
|
||||
|
||||
```csharp
|
||||
table.Alignment(Justify.Right);
|
||||
@ -91,13 +91,13 @@ table.Centered();
|
||||
table.LeftAligned();
|
||||
```
|
||||
|
||||
# Column appearance
|
||||
## Column appearance
|
||||
|
||||
<!------------------------->
|
||||
<!--- COLUMN APPEARANCE --->
|
||||
<!------------------------->
|
||||
|
||||
## Alignment
|
||||
### Alignment
|
||||
|
||||
```csharp
|
||||
table.Columns[0].Alignment(Justify.Right);
|
||||
@ -106,7 +106,7 @@ table.Columns[0].Centered();
|
||||
table.Columns[0].RightAligned();
|
||||
```
|
||||
|
||||
## Padding
|
||||
### Padding
|
||||
|
||||
```csharp
|
||||
// Set padding individually
|
||||
@ -121,14 +121,14 @@ table.Columns[0].PadLeft(3).PadRight(5);
|
||||
table.Columns[0].Padding(4, 0);
|
||||
```
|
||||
|
||||
## Disable column wrapping
|
||||
### Disable column wrapping
|
||||
|
||||
```csharp
|
||||
// Disable column wrapping
|
||||
table.Columns[0].NoWrap();
|
||||
```
|
||||
|
||||
## Set column width
|
||||
### Set column width
|
||||
|
||||
```csharp
|
||||
// Set the column width
|
||||
|
@ -4,9 +4,9 @@ Order: 10
|
||||
|
||||
The `Tree` widget can be used to render hierarchical data.
|
||||
|
||||
<img src="../assets/images/tree.png" style="width: 100%;" />
|
||||

|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
```csharp
|
||||
// Create the tree
|
||||
@ -34,22 +34,22 @@ bar.AddNode(new Calendar(2020, 12)
|
||||
AnsiConsole.Render(root);
|
||||
```
|
||||
|
||||
# Collapsing nodes
|
||||
## Collapsing nodes
|
||||
|
||||
```csharp
|
||||
root.AddNode("Label").Collapsed();
|
||||
```
|
||||
|
||||
# Appearance
|
||||
## Appearance
|
||||
|
||||
## Style
|
||||
### Style
|
||||
|
||||
```csharp
|
||||
var root = new Tree("Root")
|
||||
.Style("white on red");
|
||||
```
|
||||
|
||||
## Guide lines
|
||||
### Guide lines
|
||||
|
||||
```csharp
|
||||
// ASCII guide lines
|
||||
|
Reference in New Issue
Block a user