-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing custom MenuStyle to dialog functions #99
Conversation
Codecov Report
@@ Coverage Diff @@
## master #99 +/- ##
=========================================
Coverage 96.68% 96.68%
Complexity 293 293
=========================================
Files 22 22
Lines 905 905
=========================================
Hits 875 875
Misses 30 30
Continue to review full report at Codecov.
|
I'm not really sold on this - I'm not a fan of keep tacking on extra parameters, it looks a bit wonky - although I can't think of another way to achieve it. Functionality seems fine - I'm guessing its because you would rather set a theme once for all dialogues and pass it around? Maybe you have an idea @mikeymike or thoughts in general? Maybe there could be a separate dialogue style property on cli menu that can be set and that is used for dialogues instead? |
The first reason for this PR was that we cannot currently modify the style of those dialogues. At the very least, being able to do something like this seems necessary: $result = $menu->askText()
->setPlaceholderText('Enter something')
->setForegroundColour('white')
->setBackgroundColour('black')
->ask(); But yeah, being able to pass only one MenuStyle to every dialogues prevents would be nice (only one object, the same colours everywhere wihtout having to redefine them each time). It's something currently achievable doing this: // Let's say we already have a $menu
$diagStyle = (new MenuStyle)
->setBg('black')
->setFg('white');
$result = (new Text(new InputIO($menu, $menu->getTerminal(), $diagStyle)))
->ask(); But it isn't really nice... |
It is possible to modify the styles, both the dialogues and inputs expose a However, if thats still not enough I be happy with either a |
My .2c I think having the methods globally on the However I like the option to have a I think I've spoken to @AydinHassan about this before but one thing I'd really think would be awesome is having a CSS like approach to the styles, we'd need to classify stylable areas etc but it would make it easier for the end user |
I totally overlooked the getStyle() function. Yeah so that allows for customization. |
@Lynesth you think |
No description provided.