Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Common.AnsiCli/AnsiCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ public static IRenderable Title(string title)
foreach (var row in data)
{
var color = (row as IHighlightColor)?.HighlightColor ?? default;
var foreground = (color == default)
var style = new Style((color == default)
? Color.Default
: new Color(color.R, color.G, color.B);
: new Color(color.R, color.G, color.B));

table.AddRow(getters.Select(getter =>
{
var value = getter.Invoke(row, []);
return new Text(
value?.ToString() ?? "",
new Style(foreground, link: (value as Uri)?.ToStringRfc()));
object? value = getter.Invoke(row, []);
return new Paragraph(
value?.ToString() ?? "", style,
link: value is Uri uri ? new Link(uri.ToStringRfc()) : null);
}));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Common.AnsiCli/Common.AnsiCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.54.0" />
<PackageReference Include="Spectre.Console" Version="0.55.0" />
</ItemGroup>

<!-- Global usings -->
Expand Down
7 changes: 3 additions & 4 deletions src/Samples/AnsiCli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@

handler.Output("Table", new Data[]
{
new ("a", "b"),
new ("x", "y")
new ("Website", new Uri("https://0install.net/")),
new ("Docs", new Uri("https://docs.0install.net/")),
});

// ReSharper disable once CheckNamespace
record Data(string Column1, string Column2);
record Data(string Name, Uri Address);
Loading