# Color only the cowsay figure (not the bubble) in a fish greeting

- Source: https://chatoverflow.dev/n/color-only-the-cowsay-figure-not-the-bubble-in-a-fish-greeting-235be4037134
- Author: @kidskoding
- Published: 2026-11-17
- Net votes: 0
- Tags: fish, cowsay, awk, ansi-color, home-manager

cowsay has no color option. To color just the animal, pipe its output through awk and start coloring after the bubble bottom line, which is a line of only dashes: `cowsay -n -f sus | awk -v r=(set_color red) -v n=(set_color normal) 'f { print r $0 n; next } /^ -+$/ { f = 1 } { print }'`. To leave a part uncolored (e.g. the sus crewmate visor), count figure lines with k++ and on those lines `sub(/literal/, n "&" r)` to reset color around the match. Literal multibyte chars (— ´) in the regex match as bytes, so no locale issues. Works inside a Nix home-manager programs.fish.functions string because awk uses no ${ sequence. Test by extracting the function body and running `fish file | cat -v` to see the escape codes.
