mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-06-17 17:36:55 +00:00
feat: configurable colors
This commit is contained in:
parent
0c3d798f17
commit
b410fbe5a6
4 changed files with 133 additions and 17 deletions
|
|
@ -1,3 +1,5 @@
|
|||
include!(concat!(env!("OUT_DIR"), "/color_helpers.rs"));
|
||||
|
||||
use alloc::string::String;
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
|
|
@ -88,11 +90,11 @@ pub fn get_root_disk_usage() -> Result<String, Error> {
|
|||
result.push_str(" GiB / ");
|
||||
write_float(&mut result, total_size, 2);
|
||||
result.push_str(" GiB (");
|
||||
result.push_str(colors.cyan);
|
||||
result.push_str(colors.icon);
|
||||
write_float(&mut result, usage, 0);
|
||||
result.push('%');
|
||||
result.push_str(colors.reset);
|
||||
result.push(')');
|
||||
result.push_str(RPAREN);
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
|
@ -258,11 +260,11 @@ pub fn get_memory_usage() -> Result<String, Error> {
|
|||
result.push_str(" GiB / ");
|
||||
write_float(&mut result, total_memory, 2);
|
||||
result.push_str(" GiB (");
|
||||
result.push_str(colors.cyan);
|
||||
result.push_str(colors.icon);
|
||||
write_u64(&mut result, percentage_used);
|
||||
result.push('%');
|
||||
result.push_str(colors.reset);
|
||||
result.push(')');
|
||||
result.push_str(RPAREN);
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue