How do I print a 256-colour test pattern in my terminal?

I want to check that my terminal correctly supports 256 colours.

closed as off-topic by jasonwryan, Thomas Dickey, Archemar, GAD3R, Anthony Geoghegan Sep 6 '16 at 9:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – jasonwryan, Thomas Dickey, Archemar, GAD3R, Anthony Geoghegan

  • 6
    Please do not crosspost (askubuntu.com/questions/821157/…). – edwinksl Sep 6 '16 at 7:00
  • My understanding is that that is to prevent time being wasted answering a question already answered. It's entirely relevant to both sites... How to say which is more relevant? – Tom Hale Sep 6 '16 at 7:17
  • 2
    non Ubuntu related question should redirected here – Emmanuel Sep 6 '16 at 10:26
  • Yes - this is not limited to Ubuntu – Tom Hale Sep 6 '16 at 10:35

256-colour test pattern

256-colour test pattern

For the above, you can use my bash code. ("Look Ma, no subprocesses!")

Or for a bash quicky:

for i in {0..255} ; do
    printf "\x1b[38;5;${i}m%3d " "${i}"
    if (( $i == 15 )) || (( $i > 15 )) && (( ($i-15) % 12 == 0 )); then
        echo;
    fi
done

24-bit / truecolour test pattern

See this question for the full spectrum :)

  • Not sure why you formatted it this way but at least it works and looks good. – Julie Pelletier Sep 6 '16 at 6:42
  • 1
    Suggestions for improvement? – Tom Hale Sep 6 '16 at 6:58
  • Works also on zsh – Emmanuel Sep 6 '16 at 9:32
  • 1
    can try that one printf "%03d\e[48;5;${i}m \e[0m " $i; – Emmanuel Sep 6 '16 at 9:55

Install an application named colortest

and use the following commands to test the ASCII color graph

colortest-8   => Display color palette using 8 colors.
colortest-16  => Display color palette using 16 colors.
colortest-256 => Display color palette using 256 colors.
  • 1
    “Install an application named colortest”—this kind of begs the question. Where does that colortest package originate? It doesn’t appear to be in the Fedora or Arch repos. – phg Sep 6 '16 at 7:47
  • 1
    Said application is available for ubuntu. For more info, refer this link vim.org/scripts/script.php?script_id=1349 – SHW Sep 6 '16 at 7:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.