Windows' Command Prompt / Command Line Interface (CLI) / Console Colors

  Windows' Command Prompt, AKA CLI, or a Console has only 16 colors. Ref: learn.microsoft.com/ ... /windows-commands/color Foreground and bachground can each be set to any of the 16. Some combinations are more readable than others. In the sampler the 12 chromatic colors are shown on the 4 shades of gray. The Tester is for trying any color on any color.

  The compiled executables are in the download ZIP ConsoleColor.zip The source code is short enough to be easily copied from below.

Console Color Sampler

Reduced screen capture.
Source Code
'https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/color
#compile exe
#dim all
%black   = &h0& : %gray     = &h8&
%blue    = &h1& : %Lblue    = &h9&
%green   = &h2& : %Lgreen   = &hA&
%cyan    = &h3& : %Lcyan    = &hB&
%red     = &h4& : %LRed     = &hC&
%purple  = &h5& : %magenta  = &hD&
%brown   = &h6& : %yellow   = &hE&
%white   = &h7& : %BWhite   = &hF&
function pbmain () as long
  local CurRow as long
  con.print "############## Console Color Sampler ##############"
  con.print "PBCC and Microsoft color names differ from  each other."
  con.print "Made a couple changes too."
  con.print
  '·································································
  CurRow = con.cell.row            : con.color(%black, %white, 31)
  con.print  "black on white"      : con.cell = CurRow, 34
  con.color(%black, %BWhite)       : con.print "black on bright white"

  CurRow = con.cell.row            : con.color(%gray, %white, 31)
  con.print "gray on white"        : con.cell = CurRow, 34
  con.color(%gray, %Bwhite)        : con.print "gray on bright white"
  '··································································· blue ····
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%blue, %black, 31)
  con.print "blue on black"        : con.cell = CurRow, 34
  con.color(%blue, %gray, 31)      : con.print "blue on gray"

  CurRow = con.cell.row            : con.color(%blue, %white, 31)
  con.print "blue on white"        : con.cell = CurRow, 34
  con.color(%blue, %BWhite, 31)    : con.print "blue on bright white"

  CurRow = con.cell.row            : con.color(%Lblue, %black, 31)
  con.print "light blue on black"  : con.cell = CurRow, 34
  con.color(%Lblue, %gray, 31)     : con.print "light blue on gray"

  CurRow = con.cell.row            : con.color(%Lblue, %white, 31)
  con.print "light blue on white"  : con.cell = CurRow, 34
  con.color(%blue, %BWhite)        : con.print "light blue on bright white"
  '··································································· green ···
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%green, %black, 31)
  con.print "green on black"       : con.cell = CurRow, 34
  con.color(%green, %gray,31)      : con.print "green on gray"

  CurRow = con.cell.row            : con.color(%green, %white, 31)
  con.print "green on white"       : con.cell = CurRow, 34
  con.color(%green, %bwhite,31)    : con.print "green on bright white"

  CurRow = con.cell.row            : con.color(%lgreen, %black, 31)
  con.print "light green on black"      : con.cell = CurRow, 34
  con.color(%green, %gray,31)      : con.print "light green on gray"

  CurRow = con.cell.row            : con.color(%Lgreen, %white, 31)
  con.print "light green on white" : con.cell = CurRow, 34
  con.color(%lgreen, %bwhite,31)   : con.print "light green on bright white"
  '··································································· cyan ····
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%cyan, %black, 31)
  con.print "cyan on black"        : con.cell = CurRow, 34
  con.color(%cyan, %gray,31)       : con.print "cyan on gray"

  CurRow = con.cell.row            : con.color(%cyan, %white, 31)
  con.print "cyan on white"        : con.cell = CurRow, 34
  con.color(%cyan, %bwhite,31)     : con.print "cyan on bright white"

  CurRow = con.cell.row            : con.color(%lcyan, %black, 31)
  con.print "light cyan on black"  : con.cell = CurRow, 34
  con.color(%lcyan, %gray,31)      : con.print "light cyan on gray"

  CurRow = con.cell.row            : con.color(%Lcyan, %white, 31)
  con.print "light cyan on white"  : con.cell = CurRow, 34
  con.color(%lcyan, %bwhite,31)    : con.print "light cyan on bright white"
  '··································································· red ····
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%red, %black, 31)
  con.print "red on black"         : con.cell = CurRow, 34
  con.color(%red, %gray,31)        : con.print "red on gray"

  CurRow = con.cell.row            : con.color(%red, %white, 31)
  con.print "red on white"         : con.cell = CurRow, 34
  con.color(%red, %bwhite,31)      : con.print "red on bright white"

  CurRow = con.cell.row            : con.color(%lred, %black, 31)
  con.print "light red on black"   : con.cell = CurRow, 34
  con.color(%lred, %gray,31)       : con.print "light red on gray"

  CurRow = con.cell.row            : con.color(%Lred, %white, 31)
  con.print "light red on white"   : con.cell = CurRow, 34
  con.color(%lred, %bwhite,31)     : con.print "light red on bright white"
  '························································· purple/magenta ····
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%purple, %black, 31)
  con.print "purple on black"      : con.cell = CurRow, 34
  con.color(%purple, %gray,31)     : con.print "purple on gray"

  CurRow = con.cell.row            : con.color(%purple, %white, 31)
  con.print "purple on white"      : con.cell = CurRow, 34
  con.color(%purple, %bwhite,31)   : con.print "purple on bright white"

  CurRow = con.cell.row            : con.color(%magenta, %black, 31)
  con.print "magenta on black"     : con.cell = CurRow, 34
  con.color(%magenta, %gray,31)    : con.print "magenta on gray"

  CurRow = con.cell.row            : con.color(%magenta, %white, 31)
  con.print "magenta on white"     : con.cell = CurRow, 34
  con.color(%magenta, %bwhite,31)  : con.print "magenta on bright white"
  '································································· yellow ····
  con.color(%white, %black)        : con.print string$$(79, "·")

  CurRow = con.cell.row            : con.color(%brown, %black, 31)
  con.print "brown on black"       : con.cell = CurRow, 34
  con.color(%brown, %gray,31)      : con.print "brown on gray"

  CurRow = con.cell.row            : con.color(%brown, %white, 31)
  con.print "brown on white"       : con.cell = CurRow, 34
  con.color(%brown, %bwhite,31)    : con.print "brown on bright white"

  CurRow = con.cell.row            : con.color(%yellow, %black, 31)
  con.print "yellow on black"      : con.cell = CurRow, 34
  con.color(%yellow, %gray,31)     : con.print "yellow on gray"

  CurRow = con.cell.row            : con.color(%yellow, %white, 31)
  con.print "yellow on white"      : con.cell = CurRow, 34
  con.color(%yellow, %bwhite,31)   : con.print "yellow on bright white"
  '··································································· exit ····
  con.print
  con.color(%white, %black) : con.print string$$(79, "·")
  con.print "Any key to close."
  con.waitkey$
end function

Console Foreground/Backgroud Color Tester

Reduced screen capture.
Source Code
#compile exe
#dim all
#break off
%black   = &h0& : %gray     = &h8&
%blue    = &h1& : %Lblue    = &h9&
%green   = &h2& : %Lgreen   = &hA&
%cyan    = &h3& : %Lcyan    = &hB&
%red     = &h4& : %LRed     = &hC&
%purple  = &h5& : %magenta  = &hD&
%brown   = &h6& : %yellow   = &hE&
%white   = &h7& : %BWhite   = &hF&
function pbmain () as long
  local CurRow, ForeColor, BackColor, TmpL as long
  local TmpStr as wstring
  con.print "############## Console Color Sampler ##############"
  con.print "PBCC and Microsoft color names differ from  each other."
  con.print "Made a couple changes too. Url for Command Prompt window color:"
  con.print
  '·································································
  RunTest:
  con.color(%yellow, %black)
  con.cls
  con.print "Use decimal color values to chose foreground and baskground color."
  CurRow = con.cell.row
  con.print  "       Black - ""0"""  : con.cell = CurRow, 24
  con.print "       Gray  -  ""8"""
  CurRow = con.cell.row
  con.print  "        Blue - ""1"""  : con.cell = CurRow, 24
  con.print "  Light Blue -  ""9"""
  CurRow = con.cell.row
  con.print  "       Green - ""2"""  : con.cell = CurRow, 24
  con.print " Light Green - ""10"""
  CurRow = con.cell.row
  con.print  "        Cyan - ""3"""  : con.cell = CurRow, 24
  con.print "  Light Cyan - ""11"""
  CurRow = con.cell.row
  con.print  "         Red - ""4"""  : con.cell = CurRow, 24
  con.print "   Light Red - ""12"""
  CurRow = con.cell.row
  con.print  "      Purple - ""5"""  : con.cell = CurRow, 24
  con.print "     Magenta - ""13"""
  CurRow = con.cell.row
  con.print  "       Brown - ""6"""  : con.cell = CurRow, 24
  con.print "      Yellow - ""14"""
  CurRow = con.cell.row
  con.print  "       White - ""7"""  : con.cell = CurRow, 24
  con.print "Bright White - ""15"""
  con.print
  ColorSelection:
  CurRow = con.cell.row
  con.input ("Foreground color's value: ", TmpStr)
  gosub CheckIfValid
  ForeColor = TmpL
  gosub ColorName
  CurRow = con.cell.row
  con.input ("Background color's value: ", TmpStr)
  gosub CheckIfValid
  BackColor = TmpL
  gosub ColorName
  '
  con.color(%white, %black)
  con.print string$$(27, "·") + " Color Demonstation Area " + string$$(27, "·")
  con.print
  con.print string$$(30, $$spc);
  con.color(ForeColor, BackColor)
  con.print " Test Fore on Back "
  '··································································· exit ····
  con.print
  con.color(%white, %black) : con.print string$$(79, "·")
  con.print
  con.print """ESC"" key to close."
  con.print "Any other key to to try different colors."
  con.waitkey$ to TmpStr
  if TmpStr = $$esc then
    exit function
  else
    goto RunTest
  end if
  '------------------------------------------------------------ subroutines ----
  ColorName:
    con.cell = CurRow, 30
    select case as const TmpL
      case 0
        con.print "  Black"
      case 1
        con.print "  Blue"
      case 2
        con.print "  Green"
      case 3
        con.print "  Cyan"
      case 4
        con.print "  Red"
      case 5
        con.print "  Purple"
      case 6
        con.print "  Brown"
      case 7
        con.print "  White"
      case 8
        con.print "  Gray"
      case 9
        con.print "  Light Blue"
      case 10
        con.print "  Light Green"
      case 11
        con.print "  Light Cyan"
      case 12
        con.print "  Light Red"
      case 13
        con.print "  Magenta"
      case 14
        con.print "  Yellow"
      case 15
        con.print "  Bright White"
    end select
  return
  CheckIfValid:
    TmpL = verify(1, TmpStr, "0123456789"$$)
    if TmpL then
      con.color(%LRed, %BWhite)
      con.print "Only number characters."
      con.print "Any key to retry."
      con.waitkey$
      goto RunTest
    else
      TmpL = val(TmpStr)
      if (TmpL < 0) or (TmpL > 15) then
        con.color(%LRed, %BWhite)
        con.print "Range is ""0"" to ""15""."
        con.print "Any key to retry."
        con.waitkey$
        goto RunTest
      end if
      return
    end if
end function

Back Matter

Full copyleft (ɔ), 2026 by Dale Yarker in source or compiled form. Complete license in new tab or window.

Created on 27 May 2026.

To Dale's Notebook index.
notebook
To Programs index.
programs