feat(theme): make default icons overrideable
Resolves #1354 Partially addresses #1578
This adds the option of overriding the default icons in theme.yml.
Example theme.yml:
extensions:
.default_file: {icon: {glyph: "f"}}
.default_file_unknown: {icon: {glyph: "?"}}
.default_directory: {icon: {glyph: "d"}}
.default_directory_empty: {icon: {glyph: "e"}}
Using '.' prefix to not conflict with actual file extensions.
Output:
$ eza -ln --icons
drwxr-xr-x - 1000 22 Aug 19:18 d dir
drwxr-xr-x - 1000 22 Aug 19:17 e empty-dir
.rw-r--r-- 0 1000 22 Aug 19:17 ? file
.rw-r--r-- 0 1000 22 Aug 19:18 f file.randomextension
Wouldn’t it make more sense to extend the exsisting properties?:
filekinds:
normal: {icon: {glyph: "f"}}
normal_unknown: {icon: {glyph: "?"}} # new property
directory: {icon: {glyph: "d"}}
directory_empty: {icon: {glyph: "e"}} #new property
instead of:
extensions:
.default_file: {icon: {glyph: "f"}}
.default_file_unknown: {icon: {glyph: "?"}}
.default_directory: {icon: {glyph: "d"}}
.default_directory_empty: {icon: {glyph: "e"}}
full api:
filekinds:
normal: { filename: { foreground: White }, icon: { foreground: Blue, glyph: f } }
normal_unknown: { filename: { foreground: White }, icon: { foreground: Blue, glyph: ? } }
directory: { filename: { foreground: White }, icon: { foreground: Blue, glyph: d } }
directory_empty: { filename: { foreground: White }, icon: { foreground: Blue, glyph: e } }
@sand4rt I agree this would be the best place to put it. The reason I did not was that those are currently seperate code paths that would require (comparatively) a lot of changes to make it work. It would also be a breaking change, as it would change the schema of the theme config in a non backward compatible way.
But having it atleast as its own field should be a lot better already, instead of cramming it in with extensions.
I'll see if I manage to implement this in a better way. At the moment I don't think this PR should be merged in its current state, so I'll mark it as draft for now.
It would also be a breaking change, as it would change the schema of the theme config in a non backward compatible way
I dont think this have to be true right? The old syntax is still supported when the type is: normal: {foreground: "#e0def4"} | { filename: { foreground: White }, icon: { foreground: Blue, glyph: f } }