ANSI Grayscale Ramp (232-255) - 24 Shades of Gray

Reference for ANSI grayscale colors 232-255, providing 24 shades from near-black to near-white. Perfect for subtle UI elements, borders, and dimmed text in terminal applications.

256 Colors

Detailed Explanation

ANSI Grayscale Ramp

The grayscale ramp occupies color codes 232 through 255 in the 256-color palette, providing 24 evenly-spaced shades of gray. These are separate from the color cube and are specifically designed for grayscale output.

Grayscale Values

Each code maps to a specific gray level:

Code RGB Value Brightness
232 (8, 8, 8) Darkest
233 (18, 18, 18) Very dark
234 (28, 28, 28)
... ...
243 (118,118,118) Mid-gray
... ...
254 (228,228,228) Very light
255 (238,238,238) Lightest

The formula is: RGB = 8 + (code - 232) * 10 for each channel.

Usage Examples

# Dimmed secondary text
echo -e "\033[38;5;245mSecondary information\033[0m"

# Light gray border effect
echo -e "\033[38;5;240m────────────────────\033[0m"

# Dark background panel
echo -e "\033[48;5;234m  Dark panel content  \033[0m"

Design Applications

The grayscale ramp is invaluable for creating visual hierarchy in terminal UIs:

  • Code 240-245: Ideal for secondary/muted text
  • Code 234-237: Great for subtle panel backgrounds
  • Code 248-252: Works well for borders and dividers on dark backgrounds
  • Code 232-233: Nearly invisible on dark terminals, useful for very subtle effects

Important Considerations

Note that codes 232-255 do not include pure black (0,0,0) or pure white (255,255,255). For those, use color code 0 (black) and 15 (white) from the standard palette. The grayscale ramp starts at brightness 8 and ends at 238, leaving room for the standard black and white.

Use Case

The grayscale ramp is essential for building polished terminal UIs with visual depth and hierarchy. Use it for dimmed help text, subtle borders and separators, panel backgrounds, tree-view indent guides, and any element where full color would be distracting. Terminal dashboard tools like htop, lazydocker, and tig use grayscale extensively for professional-looking interfaces.

Try It — ANSI Color Code Reference

Open full tool