Skip to content
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

fix(color-scale): use file size unit custom color when not using color scale #975

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor Author

@bew bew May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I really don't understand why we were checking if scale.size was enabled (and if it was normal, why scale.age wasn't checked as well 🤔)

cc: @MartinFillon since you changed that condition last in #702.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well iirc it was causing another bug but idrc

Self::colourful_fixed()
} else {
Self::colourful_gradient()
Expand Down