lsd icon indicating copy to clipboard operation
lsd copied to clipboard

theme: size none color is not respected

Open edshamis opened this issue 2 years ago • 3 comments

  • os:
  • lsd --version: lsd 0.23.1
  • echo $TERM: xterm-256color
  • echo $LS_COLORS: fi=00:mi=00:mh=00:ln=01;36:or=01;31:di=01;34:ow=04;01;34:st=34:tw=04;34:pi=01;33:so=01;33:do=01;33:bd=01;33:cd=01;33:su=01;35:sg=01;35:ca=01;35:ex=01;32:no=38;5;248

Expected behavior

I expect that size none color is for zero size objects.

Actual behavior

I added a theme, changed color for small size — worked. Changed color for none — don't see that color, color for zero size files is the same as for small ones.

edshamis avatar Oct 17 '22 13:10 edshamis

Color for none is not for 0 sized item, but rather things we don't display size for. This was originally used for folders for which we did not show size, but instead showed a -. However, we have since started showing size for them and thus making it obsolete. We can maybe consider repurposing it for 0 sized items.

meain avatar Nov 27 '22 16:11 meain

Ok, thanks for clarifying. I think distinct color for zero size is a good idea.

On Sun, Nov 27, 2022, 18:35 Abin Simon @.***> wrote:

Color for none is not for 0 sized item, but rather things we don't display size for. This was originally used for folders for which we did not show size, but instead showed a -. However, we have since started showing size for them and thus making it obsolete. We can maybe consider repurposing it for 0 sized items.

— Reply to this email directly, view it on GitHub https://github.com/Peltoche/lsd/issues/755#issuecomment-1328287693, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNR4FQ4S6UKPHTAJBCG733WKOETNANCNFSM6AAAAAARHCRG7A . You are receiving this because you authored the thread.Message ID: @.***>

edshamis avatar Nov 27 '22 23:11 edshamis

index 9f39b99..74af321 100644
--- a/src/meta/size.rs
+++ b/src/meta/size.rs
@@ -89,7 +89,14 @@ impl Size {
     fn paint(&self, colors: &Colors, flags: &Flags, content: String) -> ColoredString {
         let unit = self.get_unit(flags);
         let elem = match unit {
-            Unit::Byte | Unit::Kilo => &Elem::FileSmall,
+            Unit::Byte => {
+                if self.bytes as f64 == 0.0 {
+                    &Elem::NonFile
+                } else {
+                    &Elem::FileSmall
+                }
+            }
+            Unit::Kilo => &Elem::FileSmall,
             Unit::Mega => &Elem::FileMedium,
             _ => &Elem::FileLarge,
         };

vlnx avatar Nov 28 '22 14:11 vlnx