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
support for theme.yml file #840
base: main
Are you sure you want to change the base?
Conversation
379fb26
to
0cbcf8f
Compare
Hello, is it planned that |
Yes! that is the plan, and I even have a local branch with progress made on it. As it happens, there are lots of significant changes happening in the codebase right now (clap, major dependency changes), so I didn't want to push it and try to do too much at once. That has been a very common request, so it's on top of my list |
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.
There seems to be a failing test (sorry for noise if you're still working on this, just saw review was requested so didn't wanna let it hang in case!)
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.
Could you clarify some of my concerns please ?
I was wondering how you felt about, as we have the env var, the default value, adding also a command line argument such as |
note: i have more local changes now so further review can wait till prob tomorrow I am certainly open to the command line arg. My thought was that XDG_CONFIG_HOME was pretty standard, with the option of giving an env var for fallback if someone wanted to go somewhere else. I would really like to get clap merged because it seems like this arg parser is just cursed lately 💀 |
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
The commit I added fixes the nocolor/color=never option. The gist of it is, that when UseColour never uses NoFileStyle and UiStyles::plain, and during unwrapping in Theme.colour_file the NoFileStyle.get_style returns None which makes the colour_file fall back to the UiStyles. Since UiStyles::plain simply calls default the default colors remain. By actually setting all colors to the default style in UiStyles::plain this is mitigated. And since it is only called in this case, this doesn't break anything either. |
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
This basically ports the PR eza-community#914 and thus also resolves eza-community#909 Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Hi, I can't provide a technical review but I tested this branch, the config file provides a very extensive list of options which is awesome because enable users to tweak icons without hardcoding them, very handy. I understand that a lot of extensions on my icon PR are very niche so this is very helpful. Just 2 more notes:
Very nice job, thanks! Example on LazyVim that uses Neotree that uses nvim-web-devicons |
I think @gierens had an implementation of changing the icon colors in a previous PR if I'm not mistaken? |
Point 1 (extension-based icon color overrides): While that differs from what is asked here, I think overriding the icon colors of individual extensions or filenames should be fairly straight forward from what I've already added here. The only thing I'm a little worried about is how adding a color string could affect the hashmap performance. I can take a look at it later and experiment around a bit. Point 2 (group based icon overrides): First of all this would need a more extesive design as to what the behaviour actually should be, how this should mix with the extension overrides and what takes priority ... Second, an implementation might have to touch the exact part of the code I was trying to avoid meddling with here: Third, I'm not sure how much value this adds for the user in comparison to the complexity it might introduce. The current proposal here is imho quite elegant because it is extension/filename-based and thus completely circumvents the maps in the icon module which also makes it quite intuitive because the user has fine-grained control and does not need to know about how eza internally maps TLDR: |
Thanks for the explanation, and sure for point 2, the worst case would be that user needs to repeat a few times the same glyph, is not a big deal, it's preferable that both the code and the config file remains simple. |
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
@hasecilu I added a style field to icon overrides in the config file: @PThorpe92 I first just wanted to add a color to icons but then thought, why not the whole This works by defining a mirror for every struct in and including While this bloats the |
Looks good, testing was ok |
Signed-off-by: Preston Thorpe <preston@unlockedlabs.org>
@cafkafk this should be all set |
Hi again, I was changing some colors when I noticed that having a good config file resets the foreground color of the filename given by its type (document, video, image, source code, etc). When something fails (I used "Reda" as color) filename fg color is preserved, is this the desired behavior or fg color should be maintained? EDIT: Tested with files that were already on eza and seems to work as expected with all files except "source code" files, my testing branch this branchmy branch |
@hasecilu I'm not certain I fully understand what your are referring to, but I'll do my best to answer. So, I believe you are mentioning two problems: 1. Theming in case of a bad config file: 2. Filename colors differing from icon colors: Theoretically I could also add the option to configure the filename color next to the icon color for some extension or filename. I thought about adding this functionality already. |
What I wanted to say is: it seems that something is conflicting in the filenames color of some types of file (at least the source code). From the first picture
"c" => FileType::Source, // C/C++
"cpp" => FileType::Source, // C/C++
I don't think this is the expected behavior because other types of files preserve their filename fg color.
Agree |
@hasecilu Sorry, but I'm still a little confused maybe because it's getting late and my brain is not working at full capacity anymore and the second screenshot being a little full. Could you provide a minimal example? So a config file with just the necessary configuration and a directory with just the necessary files (so ideally just a few lines and files in both cases) that trigger that unexpected behavior. |
Correct me if I'm wrong @hasecilu but I believe you are concerned about this example: The first command here is run with the default configuration and the second is run using the configuration below: icons:
extensions:
c: { style: { foreground: Red } } I believe @hasecilu expects the foreground color of the filename in the output of the second command to remain yellow. |
mkdir testing && cd testing
touch f.flac g.gpg lib.o main.c main.cpp main.py p.png m.mp4 s.svg z.zip && eza --icons
icons:
extensions:
c: { style: { foreground: Red } }
cpp: { style: { foreground: White } }
flac: { style: { foreground: Black } }
gpg: { style: { foreground: Blue } }
mp4: { style: { foreground: Cyan } }
o: { style: { foreground: Magenta } }
png: { style: { foreground: Red } }
py: { style: { foreground: Green } }
svg: { style: { foreground: Yellow } }
tmp: { style: { foreground: Blue } }
zip: { style: { foreground: Magenta } }
echo -e "This is the default behaviour\n" && EZA_CONFIG_DIR=.. eza --icons
echo -e "This is the attempt to change icon color, filenames color is not always preserved\n" && EZA_CONFIG_DIR=. eza --icons
Exactly |
Sorry for the late reply guys, and big thanks @newo-2001 and @hasecilu for pointing out the issue! Now I see it, too, and also where I messed up. I've got a rough idea how to fix it. |
@gierens I finally had a few mins of free time, I looked at this and I wasn't able to locate where the issue is this time. |
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
After 1.5 hours and more black magic I think I've fixed it. Basically the
@PThorpe92 No worries, this was neither easy to spot nor trivial to solve. My head hurts 😵 haha |
@PThorpe92 I have one final idea assuming this works and no more repairs are required: Since the icon overrides are filename- or extension-based, we could make a general filename style override out of this where users can edit both the filename style and the icon style. What do you think? |
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
This is the base of what we will need for a
config.yml
, which will build on top of this. This includes the changes from #744 as it was necessary in order to serialize theStyle
struct.