Add support for selection prompt highlighting

This commit is contained in:
Nick
2021-01-15 14:23:09 +00:00
committed by GitHub
parent 1a747696a8
commit 63bae278a9
6 changed files with 52 additions and 6 deletions

View File

@ -103,6 +103,24 @@ namespace Spectre.Console
return obj;
}
/// <summary>
/// Sets the highlight style of the selected choice.
/// </summary>
/// <typeparam name="T">The prompt result type.</typeparam>
/// <param name="obj">The prompt.</param>
/// <param name="highlightStyle">The highlight style of the selected choice.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static MultiSelectionPrompt<T> HighlightStyle<T>(this MultiSelectionPrompt<T> obj, Style highlightStyle)
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.HighlightStyle = highlightStyle;
return obj;
}
/// <summary>
/// Requires no choice to be selected.
/// </summary>