-
Notifications
You must be signed in to change notification settings - Fork 191
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
feat: apply light mode color to icon overrides #374
base: master
Are you sure you want to change the base?
Conversation
This commit also fixes an issue where override colors would be reset if only the cterm_color value was present.
This is a fantastic change @ribru17 however this adds too much runtime complexity. We explicitly decided to do any such calculations at compile time. Stepping back and looking at the problem:
We could resolve 1 and 2 by providing a mechanism to specify multiple overrides: dark and light. The user can pre-determine the colours they desire. We can't change the API however we can add. Perhaps a |
Sounds good, this is a better way to do it. I have a question: would a value of |
Yes, that's a bit confusing. How about an enum: |
Cool! And if not present, default to both I assume? Trying to make sure I understand fully before amending the PR |
Edit: You're right. That is current behaviour. |
I'm realizing an issue: say I want to Note: If we go with the second way, I think it would be sufficient to add just the |
Yes, there's no way around storing two overrides.
I think you're right, it is far more intuitive and clear than a mode value. Light versions of API methods and |
Could we maybe make color key also able to take a table? If table first value would be what it is now and second would be a value for other mode. If single string just continue with current somewhat broken experience. (Not at my pc to check code in more detail.) |
More so, we could even merge two large tables internally and use two colours side by side. |
I like this idea a lot |
@alex-courtis What do you think about this? |
That could work. It would not break existing API (we'd keep both versions) and would allow a better user experience. Let's see how it looks... |
Any updates @ribru17 ? |
Sorry, I haven't taken a look at this in a while, I've been getting a bit busy sadly. I will have time in 3 weeks to take an extended go at this but I am also fine if someone else wants to pick it up |
Thanks mate, no pressure at all |
Some things to think about after examining the code for some time:
|
|
I mean we could try and merge them this way, but I meant in a meta-programming way where we can just merge the two icons files, getting rid of one and then we just have one source of truth containing both the light and dark colors. I am trying to think maybe of a macro that could do this easily but it seems difficult |
That family is currently returning only the dark or light based on the We shouldn't need to break that, however we can add a boolean or enum to |
I'm optimistic: we can do this without breaking anything. |
Oh I see... #414 should cover that. |
This PR makes it so that icon overrides automatically adjust to their light-mode color counterparts upon background change. It also fixes a bug that I found where override highlights would still be reset to white if only the
cterm_color
value was present.It does this using the help of the color darkening function from the scripts file (which unfortunately cannot be imported directly as it is not in the
lua
directory) and a gist documenting conversions, which I linked in a comment.