Feature: Color override setting for file/directory indicator column
Attempt at fixing #574 . Provide two new theme options:
file-indicator: 43
directory-indicator: 65
(numbers in example are arbitrary, and can be any color currently supported)
I thought one for each made more sense than a common one. Feel free to disagree.
The indicators use the theme in the file if found, if not they use the defaults for file/directory names. LS_COLORS color is only used if no theme setting is provided. This is based upon the following comment in the feature suggestion, which I found reasonable:
I suggest an optional setting in the theme yaml. If this field is absent, fall back to the file type color from LS_COLORS.
I was unsure on how to test the LS_COLORS bits, so have briefly tested that manually. Please tell me if I'm missing something and there are good ways of writing tests for them 🙂
In general I'm fairly new to Rust, so any feedback is greatly appreciated! 🙂
TODO
- [x] Use
cargo fmt - [x] Add necessary tests
- [x] Add changelog entry
- [x] Update default config/theme in README (if applicable)
- [x] Update man page at lsd/doc/lsd.md (if applicable)
Codecov Report
Merging #725 (6d7fc74) into master (d538d74) will decrease coverage by
0.84%. The diff coverage is76.47%.
@@ Coverage Diff @@
## master #725 +/- ##
==========================================
- Coverage 88.31% 87.46% -0.85%
==========================================
Files 41 41
Lines 4500 4586 +86
==========================================
+ Hits 3974 4011 +37
- Misses 526 575 +49
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/color.rs | 52.58% <70.27%> (+3.71%) |
:arrow_up: |
| src/color/theme.rs | 64.57% <91.66%> (+1.99%) |
:arrow_up: |
| src/meta/filetype.rs | 82.85% <100.00%> (ø) |
|
| src/display.rs | 83.93% <0.00%> (-8.90%) |
:arrow_down: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
I think it would be better to keep just one color. This feature will be mostly if folks want to make everything consistent (you can see something similar in the original issue). When they want custom colors, I think it will be better to match LS_COLORS.
PS: If we were to go the route of implementing separate colors we would need more than just file and dir colors, for example symlinks, block devices etc.