repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
nugu/pi_ext.nu
Rawuse palette.nu
# Generate the palette installed into pi-ext as assets/nugu.json.
# pi-ext renders README banners from it (scripts/readme/banner.ts) and expects
# both modes with the semantic `content` and `ui` groups unchanged.
def mode [mode: string] {
let p = (palette nugu $mode).palette
{ content: $p.content, ui: $p.ui }
}
export def palette [] {
{
"$comment": "Installed by the nugu pi-ext recipe from dotfiles/nugu. Do not edit here; rerun the recipe."
dark: (mode dark)
light: (mode light)
} | to json --indent 1 | lines | each { |line|
# pi-ext formats JSON with tabs; `to json` only knows spaces.
let indent = ($line | parse --regex '^(?<spaces> *)' | get 0.spaces | str length)
(if $indent == 0 { "" } else { "\t" | fill --width $indent --character "\t" }) + ($line | str trim --left)
} | str join "\n" | $in + "\n"
}