From 545898abfca7dd40375a4348797c8163ef83533d Mon Sep 17 00:00:00 2001 From: Filip Horvat Date: Wed, 25 Sep 2024 17:42:24 +0200 Subject: [PATCH] Add SearchHighlightStyle method to SelectionPromptExtensions --- .../Prompts/SelectionPromptExtensions.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Spectre.Console/Prompts/SelectionPromptExtensions.cs b/src/Spectre.Console/Prompts/SelectionPromptExtensions.cs index a5d7be133..00b92d734 100644 --- a/src/Spectre.Console/Prompts/SelectionPromptExtensions.cs +++ b/src/Spectre.Console/Prompts/SelectionPromptExtensions.cs @@ -256,6 +256,25 @@ public static SelectionPrompt HighlightStyle(this SelectionPrompt obj, return obj; } + /// + /// Sets the highlight style of the search results. + /// + /// The prompt result type. + /// The prompt. + /// The highlight style of the selected choice. + /// The same instance so that multiple calls can be chained. + public static SelectionPrompt SearchHighlightStyle(this SelectionPrompt obj, Style style) + where T : notnull + { + if (obj is null) + { + throw new ArgumentNullException(nameof(obj)); + } + + obj.SearchHighlightStyle = style; + return obj; + } + /// /// Sets the text that will be displayed if there are more choices to show. ///