export def powerline [ bg: string elem: list --separator = '' --start = '' --end = '' ] { if ($elem | is-empty) { return } let first = ($elem | first) let last = ($elem | last) ($elem | window 2 | each {|it| $"(ansi {fg: $it.0.fg, bg: $it.0.bg})($it.0.icon? | default '') ($it.0.text? | default '')(ansi {fg: $it.0.bg, bg: $it.1.bg})($separator)" } | append $"(ansi {fg: $last.fg, bg: $last.bg})($last.icon? | default '') ($last.text? | default '')(ansi {fg: $last.bg, bg: $bg})($end)(ansi reset)" | prepend $"(ansi {fg: $bg, bg: $first.bg})($start)" | str join "" ) }