-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Fix issue 244 #245
Fix issue 244 #245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution, thank you. And it looks good in your screenshot! I've never seen Amfora like that before, it's the right way to go.
Since your solution only works for backgrounds (for text it just seems to use white every time) I've suggested a change that will make it only apply when used with bg
. Please note that in default-config.toml
.
Also, this should be changed from "none" to "default", I think that name works better.
After making your changes, run make gen
(or just go generate ./...
), like I did for this PR earlier in df21b0b. This will copy the config change into the code.
Sure thing! I'll get right to working on that. Maybe, limit Also, no need to worry about the "transparency". It will always show right through the terminal instead of revealing any widgets behind, because the background isn't really transparent, it's "filled" with the color, and overwrites the pixels there. Transparency to reveal other widgets would require this Here is an example where both the |
Sounds good to me! Good point that those ones could make use of this setting as well. |
@makeworld-the-better-one Also, |
Thanks for updating!
I mentioned that in my previous comment. I don't think this function should happen. Until using |
Yes, so the user cannot specify My code always respects the user's config. The only time the text can change depending on the background is when a UI element is focused, and its background is |
config/theme.go
Outdated
const gray = 0x88 + 0x88 + 0x88 // The sum of gray's R, G, and B | ||
if r+g+b > gray { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "middle gray" as perceived by humans is 119. So I would set gray
equal to that. I would calculate the gray value of the color more accurately as 77*r+150*g+29*b + (1<<7) >> 8
, and then compare that to gray
. Overall this will be more accurate in determining color luminance.
Otherwise looks good, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to keep going back and forth on this, just noticed some more things as I went through the PR. Thanks for your work.
form.SetButtonBackgroundColorFocused(config.GetColor("btn_text")) | ||
form.SetButtonTextColorFocused(config.GetColor("btn_bg")) | ||
form.SetButtonTextColorFocused(config.GetTextColor("btn_bg", "btn_text")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this function call, and all the others in this PR, incorrect? The function signature for GetTextColor
is GetTextColor(key, bg string) tcell.Color
, which would indicate having "btn_bg"
second and "btn_text"
first. Or am I misunderstanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for focused UI elements, the text color and bg color swap. When focused, the button has text color of whatever "btn_bg"
is set to, and a bg of whatever color "btn_text"
is set to.
Because "default"
is not a valid text color in the config, this function is always called with a key ending with bg
as its key, and a bg
ending with text.
I tried to be as concise as possible with the naming. Maybe SwapColor(new_text_key, new_bg_key string)
or something similar would be less confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think it's good the way it is then, I just misunderstood.
Co-authored-by: makeworld <25111343+makeworld-the-better-one@users.noreply.github.com>
Co-authored-by: makeworld <25111343+makeworld-the-better-one@users.noreply.github.com>
…omments to be more readable
Thank you for working on this! Sorry for sleeping on it, don't be afraid to ping if you need in the future. |
happy to help :) |
Added support for Terminal Default Colors (which may or may not be transparent)
"none"
in your config file sets the color to the default color of the terminal, ortcell.ColorDefault
, as defined here.On terminals which support transparency and are configured as such, setting
bg = "none"
keeps the transparencyexample with the simple terminal using the alpha patch:
