You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I love this library but I have one idea that would make me very happy.
Everything in the library apart from the checkbox-selected indicator (the X in the MultiSelectionPrompt checkbox) is capable of being styled. I'd love to be able to have this match the style that's applied to the multi-select list rather than being hard coded to blue.
Here's an example where I've tried to make everything orange but the checkboxes are blue X's:
Someone else has tried to open a PR for this last year but I think they've jumped in without an issue/discussion first #1244 so I thought I'd try get some feedback here.
I'm happy to give this a crack but would like to know what kind of direction to go in or whether it's not something worth doing right now. I've put down a couple of ideas below.
Why this matters to me?
I'm just a bit pedantic and like to have a consistent theme in my apps. If I need multi select boxes because I can't change the X color so I make the rest of the app fit by making it all blue 😆
I wrote this PowerShell wrapper for Spectre Console and some PS folk still use blue backgrounds for their terminal so the blue checkbox indicator can blend in to the background too much https://github.com/ShaunLawrie/PwshSpectreConsole
My quick implementation idea
I would take a similar approach to the existing PR #1244 but would not add the function to the constants file, I'd add it as a private function of the MultiSelectionPrompt.
ListPromptConstants.cs
The constants could be tweaked to exclude the colors for the selected checkbox.
public const string Checkbox = "[[ ]]";
- public const string SelectedCheckbox = "[[[blue]X[/]]]";- public const string GroupSelectedCheckbox = "[[[grey]X[/]]]";+ public const string SelectedCheckboxIndicator = "X";+ public const string GroupSelectedCheckboxColor = "grey";
MultiSelectionPrompt.cs
The GetCheckbox function idea here is similar to the one in the other PR but it handles the parent checkbox using the muted color grey because it's just a grouping, it's not actually one of the selected items.
The alternative I see is to fully remove the hard coded colors and add a couple of new properties to the multiselection prompt. This is the only place other than a couple of live progress renderables where I can see non-overridable colors being used in the library.
/// <summary>
/// Gets or sets the highlight style of the selected choice.
/// </summary>
public Style? HighlightStyle { get; set; }
++ /// <summary>+ /// Gets or sets the selected style of the checkbox.+ /// </summary>+ public Style? CheckboxStyle { get; set; }++ /// <summary>+ /// Gets or sets the highlight style of the group checkbox.+ /// </summary>+ public Style? GroupCheckboxStyle { get; set; }
With this you could also expose a property for the selected indicator to use something other than "X" but that opens a can of worms because not all characters are rendered the same width so I imagine it's more hassle than it's worth.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I love this library but I have one idea that would make me very happy.
Everything in the library apart from the checkbox-selected indicator (the X in the MultiSelectionPrompt checkbox) is capable of being styled. I'd love to be able to have this match the style that's applied to the multi-select list rather than being hard coded to blue.
Here's an example where I've tried to make everything orange but the checkboxes are blue X's:
Someone else has tried to open a PR for this last year but I think they've jumped in without an issue/discussion first #1244 so I thought I'd try get some feedback here.
I'm happy to give this a crack but would like to know what kind of direction to go in or whether it's not something worth doing right now. I've put down a couple of ideas below.
Why this matters to me?
I'm just a bit pedantic and like to have a consistent theme in my apps. If I need multi select boxes because I can't change the X color so I make the rest of the app fit by making it all blue 😆
I wrote this PowerShell wrapper for Spectre Console and some PS folk still use blue backgrounds for their terminal so the blue checkbox indicator can blend in to the background too much https://github.com/ShaunLawrie/PwshSpectreConsole
My quick implementation idea
I would take a similar approach to the existing PR #1244 but would not add the function to the constants file, I'd add it as a private function of the MultiSelectionPrompt.
ListPromptConstants.cs
The constants could be tweaked to exclude the colors for the selected checkbox.
MultiSelectionPrompt.cs
The GetCheckbox function idea here is similar to the one in the other PR but it handles the parent checkbox using the muted color grey because it's just a grouping, it's not actually one of the selected items.
My alternative implementation idea
The alternative I see is to fully remove the hard coded colors and add a couple of new properties to the multiselection prompt. This is the only place other than a couple of live progress renderables where I can see non-overridable colors being used in the library.
With this you could also expose a property for the selected indicator to use something other than "X" but that opens a can of worms because not all characters are rendered the same width so I imagine it's more hassle than it's worth.
Thanks for the awesome library!
Beta Was this translation helpful? Give feedback.
All reactions