/
color-output.md
29 lines (21 loc) · 1.07 KB
/
color-output.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Color Test Result Output
## Configuration
To enable the colorization of the test result output, you can turn the `trace.coloredOutput` to true in the [configuration](../installation/configuration)
The color will only be visible in supported place, like in Rider test runner or in the console when running test using `dotnet test`.
You can turn off the color by setting `NO_COLOR=1` environment variable. This can be useful when you run the tests on a build server that does not support colors.
## Customization
You can customize the colors by configuring a Hook and injecting `IColorOutputTheme` like in the following example.
```{code-block} csharp
:caption: Hook File
[Binding]
public class Hooks
{
[BeforeTestRun]
public static void ConfigureColor(IColorOutputTheme colorOutputTheme)
{
colorOutputTheme.Keyword = AnsiColor.Reset;
colorOutputTheme.Error = AnsiColor.Composite(AnsiColor.Bold, AnsiColor.Foreground(TerminalRgbColor.FromHex("FF8EF3")));
colorOutputTheme.Done = AnsiColor.Foreground(TerminalRgbColor.FromHex("3A86FF"));
}
}
```