summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2016-10-30 15:09:36 +0000
committerBen S <ogham@bsago.me>2016-10-30 15:09:36 +0000
commit91e8ef5c7802b3305e0e3fcb9d001f42f35670f8 (patch)
treed565e716107722a6065fffe89ed6fa7d6c89acb2
parent93f8ad27dc52aca38d88288f75561008a67e8608 (diff)
Prepare to make the size colour take an argument
This makes the Colours value pick a colour based on the size of the file, instead of necessarily having them all green. (They are all green for now, though.)
-rw-r--r--src/output/colours.rs4
-rw-r--r--src/output/details.rs6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/output/colours.rs b/src/output/colours.rs
index 5708032..257e40e 100644
--- a/src/output/colours.rs
+++ b/src/output/colours.rs
@@ -169,4 +169,8 @@ impl Colours {
broken_filename: Red.underline()
}
}
+
+ pub fn file_size(&self, _size: u64) -> Style {
+ self.size.numbers
+ }
}
diff --git a/src/output/details.rs b/src/output/details.rs
index dba804c..a8bdb7a 100644
--- a/src/output/details.rs
+++ b/src/output/details.rs
@@ -586,12 +586,12 @@ impl<'a, U: Users+Groups+'a> Table<'a, U> {
SizeFormat::BinaryBytes => binary_prefix(size as f64),
SizeFormat::JustBytes => {
let string = self.env.numeric.format_int(size);
- return TextCell::paint(self.opts.colours.size.numbers, string);
+ return TextCell::paint(self.opts.colours.file_size(size), string);
},
};
let (prefix, n) = match result {
- Standalone(b) => return TextCell::paint(self.opts.colours.size.numbers, b.to_string()),
+ Standalone(b) => return TextCell::paint(self.opts.colours.file_size(b as u64), b.to_string()),
Prefixed(p, n) => (p, n)
};
@@ -606,7 +606,7 @@ impl<'a, U: Users+Groups+'a> Table<'a, U> {
TextCell {
width: width,
contents: vec![
- self.opts.colours.size.numbers.paint(number),
+ self.opts.colours.file_size(size).paint(number),
self.opts.colours.size.unit.paint(symbol),
].into(),
}