-
Notifications
You must be signed in to change notification settings - Fork 86
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
Improve dialog color api #454
Conversation
1f8d765
to
16d09bd
Compare
cc @nobu |
Do you think fg and bg should be able to set separately? |
I think having separate APIs that only take 1 argument is easier to understand. If we take 2 colors, the API name will be
And because |
16d09bd
to
6efbc9c
Compare
After thinking about it, I think the lack of documentation shouldn't affect how we design an API. So please ignore this. With that being said, other configs don't seem to take multiple values yet? If that's true, I think it's another reason we should keep it to a single value API. |
@nobu Let me know what you think. If you still think 2-value API is better, I'll change it. |
6efbc9c
to
d1ff43b
Compare
As pointed out in the [comment](ruby#413 (comment)), the code is actually a control sequence and not only for colors. To make the dialog color APIs safer to use, we should restrict its usages and extract away the bg/fg concept from the input. So in this commit, I made these changes: 1. The dialog_*_bg/fg_color APIs only takes and returns color names (symbol): - :black - :red - :green - :yellow - :blue - :magenta - :cyan - :white 2. Add additional dialog_*_bg/fg_color_sequence APIs to access the raw code.
d1ff43b
to
b32a977
Compare
@hsbt Do you think the updated API looks good? |
Looks much better than bare integers. 😃 |
As pointed out in the comment, the code is actually a control sequence and not only for colors.
To make the dialog color APIs safer to use, we should restrict its usages and extract away the bg/fg concept from the input.
So in this PR, I made these changes:
dialog_*_bg/fg_color
APIs only takes and returns color names (symbol):dialog_*_bg/fg_color_sequence
APIs to read the raw color sequences.Example