Styleable MultiSelectionPrompts #1428
ShaunLawrie
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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