Skip to content

Commit

Permalink
fix(color-scale): file size unit custom color when not using color scale
Browse files Browse the repository at this point in the history
  • Loading branch information
bew authored and cafkafk committed May 23, 2024
1 parent 22dbeec commit e52c367
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion man/eza.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Use comma(,) separated list of all, age, size
`--color-scale-mode`, `--colour-scale-mode`
: Use gradient or fixed colors in `--color-scale`.

Valid options are `fixed` or `gradient`.
Valid options are `fixed` to use a fixed color (disabling color scale), or `gradient` to use an automatic darker (old/small file) to lighter (recent/big file) gradient of colors.
The default value is `gradient`.

`--icons=WHEN`
Expand Down
2 changes: 2 additions & 0 deletions src/output/color_scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ pub struct ColorScaleOptions {

#[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub enum ColorScaleMode {
// Color scale is disabled, use a static color for the range
Fixed,
// Color scale uses an automatic gradient of colors for the range
Gradient,
}

Expand Down
2 changes: 1 addition & 1 deletion src/output/render/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl f::Size {
vec![
csi.adjust_style(colours.size(Some(prefix)), size as f32, csi.size)
.paint(number),
csi.adjust_style(colours.size(Some(prefix)), size as f32, csi.size)
csi.adjust_style(colours.unit(Some(prefix)), size as f32, csi.size)
.paint(symbol),
]
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/theme/default_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl UiStyles {

impl Size {
pub fn colourful(scale: ColorScaleOptions) -> Self {
if scale.size && scale.mode == ColorScaleMode::Fixed {
if scale.mode == ColorScaleMode::Fixed {
Self::colourful_fixed()
} else {
Self::colourful_gradient()
Expand Down

0 comments on commit e52c367

Please sign in to comment.