campaignjae.blogg.se

Color print test page
Color print test page













color print test page

# Change text color from black to white when it might become unreadableĬontext.update(normal=normal.format(i=0))Ĭontext.update(normal=normal. '' # pad the background on the other sideīase_context = dict(reset=reset, padding='', width=get_width())įor i, (r, g, b) in enumerate(colored_palette + grayscale_palette, 16):Ĭontext = dict(i=i, r=r, g=g, b=b, color=r + g + b, **base_context)Ĭontext.update(bold=bold.format(**context))Ĭontext.update(background=background.format(**context)) # Since we have 6 columns with 1 space on each side, we can increment the _, columns = subprocess.check_output().split()Ĭolumns = os.environ.get('COLUMNS', default) '''Attempt to detect console width and default to 80'''Ĭolumns, rows = shutil.get_terminal_size() Perhaps superfluous but I've written a version that prints the 256 colors using the background with automatic shell width detection so the colors are more easily visible.

color print test page

This screenshot shows about half of the output:

color print test page

At least that's how xterm and VTE (GNOME Terminal etc.) behave. bright ambiguity, namely that the boldness escape sequence combined with one of the legacy 8 colors' escape sequence for the foreground also switches to the bright counterpart color, whereas with the new style (256-color capable) escape sequences this is no longer the case, not even for the first 8 colors. The top of the output (not shown in the screenshot below) demonstrates the craziness that goes around with the bold vs. The vertical bars provide you the ability to examine the exact RGB of the foreground color without antialiasing kicking in (as it does at the digits). The first digits of the indices are stripped for compactness, you can easily figure them out. It requires a window of 120-ish or more columns, but arranges the colors of the 6圆圆 cube nicely and compactly. Yet another script, written by me, is located in the VTE repository. Hex = (normal + "%s" + reset) % (i, color)

color print test page

Grayscale = įor (i, color) in enumerate(colored_palette + grayscale_palette, 16): Print "Color indexes should be drawn in bold text of the same color."Ĭolored = + Here's the script in full in case of link-rot: #!/usr/bin/env python Give it execute permission chmod +x colortest.py I found a nice Python script for that on GitHub written by Justin Abrahms which also prints the hex codes of the colours.ĭownload the script to current working directory wget















Color print test page