Skip to content

Instantly share code, notes, and snippets.

@apolopena
Last active December 16, 2022 17:47
Show Gist options
  • Save apolopena/d00aa25efcbe5137ca1e5fb4aa6c3b82 to your computer and use it in GitHub Desktop.
Save apolopena/d00aa25efcbe5137ca1e5fb4aa6c3b82 to your computer and use it in GitHub Desktop.
Capture a raw dump of lolcat colorized output (for a script or a command) that includes the ANSI escape sequences for the colors.

The Need

  • You need a raw dump of lolcat colorized output that includes the ANSI escape sequences for the colors.
  • You need this dump saved to a file.

The Solution

Pipe your output through lolcat, use the --force flag and then redirect the output to a file.

Examples

  1. Capture a raw dump of the output of a bash script piped through lolcat to the file colors.txt

    • bash my-script.sh | lolcat --force > colors.txt
  2. Capture a raw dump of the output an echo command piped through lolcat to the file colors.txt

    • echo -n "foobarbaz" | lolcat --force > colors.txt
  3. Dial in lolcat output how you want it using the --seed option and then once you like what you see pipe it to a file

    1. echo -n "gitpod-laravel-starter UPDATER" | lolcat --spread 0.1 --seed 5141 --freq .0048
    2. echo -n "gitpod-laravel-starter UPDATER" | lolcat --spread 0.1 --seed 5141 --freq .0048 --force > colors.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment