do flag thing help
This commit is contained in:
parent
3d2719f2f7
commit
62539db84d
6 changed files with 51 additions and 36 deletions
|
@ -10,11 +10,17 @@ const ENBY = [ FCF434 FFFFFF 9C59D1 2C2C2C ];
|
|||
|
||||
def flag [
|
||||
colors: list<string>
|
||||
character = "="
|
||||
width = -1,
|
||||
] {
|
||||
use std;
|
||||
|
||||
let col_size = (term size | get columns) / ($colors | length) | math floor;
|
||||
mut rest = (term size | get columns) - ($col_size * ($colors | length));
|
||||
let out_size = if ($width == -1) {
|
||||
term size | get columns
|
||||
} else { $width };
|
||||
|
||||
let col_size = $out_size / ($colors | length) | math floor;
|
||||
mut rest = $out_size - ($col_size * ($colors | length));
|
||||
|
||||
mut cols = $colors | wrap color | insert width $col_size | flatten;
|
||||
let last = ($colors | length) - 1;
|
||||
|
@ -35,14 +41,14 @@ def flag [
|
|||
|
||||
$cols = ($cols | update 0 { $in | update width {|w| ($w.width + $amount) } } | update $last { $in | update width {|w| ($w.width + $amount) } });
|
||||
|
||||
print ($cols | each {|col|
|
||||
"=" | std repeat $col.width | prepend (ansi {fg: $"#($col.color)" }) | str join
|
||||
} | prepend (ansi attr_bold) | append (ansi reset) | str join)
|
||||
$cols | each {|col|
|
||||
$character | std repeat $col.width | prepend (ansi {fg: $"#($col.color)" }) | str join
|
||||
} | prepend (ansi attr_bold) | append (ansi reset) | str join
|
||||
}
|
||||
|
||||
def main [] {
|
||||
flag $TRANS;
|
||||
print (flag $TRANS);
|
||||
print $"(ansi attr_bold) Hi jade, you're on HRT for ((date now) - ('2024-02-18T20:53' | into datetime) | format duration month)s now!";
|
||||
flag $LESBIAN;
|
||||
# print (flag $LESBIAN);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue