Jelajahi Sumber

Standardise on a grey

Ben S 11 tahun lalu
induk
melakukan
44628ba6e2
3 mengubah file dengan 9 tambahan dan 7 penghapusan
  1. 2 0
      src/colours.rs
  2. 5 5
      src/file.rs
  3. 2 2
      src/filetype.rs

+ 2 - 0
src/colours.rs

@@ -46,6 +46,8 @@ impl Colour {
     }        
 }
 
+pub static Grey: Colour = Fixed(244);
+
 // There are only three different styles: plain (no formatting), only
 // a foreground colour, and a catch-all for anything more complicated
 // than that. It's technically possible to write other cases such as

+ 5 - 5
src/file.rs

@@ -1,4 +1,4 @@
-use colours::{Plain, Style, Black, Red, Green, Yellow, Blue, Purple, Cyan, Fixed};
+use colours::{Plain, Style, Red, Green, Yellow, Blue, Purple, Cyan, Grey};
 use std::io::{fs, IoResult};
 use std::io;
 use std::str::from_utf8_lossy;
@@ -115,7 +115,7 @@ impl<'a> File<'a> {
                     Cyan.paint(self.stat.unstable.blocks.to_str().as_slice())
                 }
                 else {
-                    Fixed(244).paint("-")
+                    Grey.paint("-")
                 }
             },
 
@@ -175,7 +175,7 @@ impl<'a> File<'a> {
         // that reason anyway.
 
         match link_target {
-            Ok(file) => format!("{} {}", Fixed(244).paint("=>"), file.file_colour().paint(filename.as_slice())),
+            Ok(file) => format!("{} {}", Grey.paint("=>"), file.file_colour().paint(filename.as_slice())),
             Err(_)   => format!("{} {}", Red.paint("=>"), Red.underline().paint(filename.as_slice())),
         }
     }
@@ -184,7 +184,7 @@ impl<'a> File<'a> {
         // Don't report file sizes for directories. I've never looked
         // at one of those numbers and gained any information from it.
         if self.stat.kind == io::TypeDirectory {
-            Fixed(244).paint("-")
+            Grey.paint("-")
         } else {
             let (size, suffix) = if use_iec_prefixes {
                 format_IEC_bytes(self.stat.size)
@@ -234,7 +234,7 @@ impl<'a> File<'a> {
         if bits.contains(bit) {
             style.paint(character.as_slice())
         } else {
-            Black.bold().paint("-".as_slice())
+            Grey.paint("-".as_slice())
         }
     }
 }

+ 2 - 2
src/filetype.rs

@@ -1,4 +1,4 @@
-use colours::{Plain, Style, Red, Green, Yellow, Blue, Cyan, Fixed};
+use colours::{Plain, Style, Red, Green, Yellow, Blue, Cyan, Grey, Fixed};
 use file::File;
 use std::io;
 
@@ -60,7 +60,7 @@ impl FileType {
             Crypto => Fixed(109).normal(),
             Document => Fixed(105).normal(),
             Compressed => Red.normal(),
-            Temp => Fixed(244).normal(),
+            Temp => Grey.normal(),
             Immediate => Yellow.bold().underline(),
             Compiled => Fixed(137).normal(),
         }