Results 1 to 1 of 1

Thread: Console Colors

  1. #1
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152

    Console Colors

    Hi volunteers.

    Here is a little program, that I think shows all of the console foreground colors (except for black).

    DTB.

    [code=thinbasic]'-------------------------------------------------------
    ' FILE = Console_Colors.tbasicc
    '-------------------------------------------------------

    Uses "Console"

    Begin Const
    %BLACK = 00
    %BLUE = 01
    %GREEN = 02
    %CYAN = 03
    %RED = 04
    %MAGENTA = 05
    %BROWN = 06
    %WHITE = 07
    %GRAY = 08
    %LIGHTBLUE = 09
    %LIGHTGREEN = 10
    %LIGHTCYAN = 11
    %LIGHTRED = 12
    %LIGHTMAGENTA = 13
    %YELLOW = 14
    %HIWHITE = 15
    End Const

    '-------------------------------------------------------

    Function TBMAIN()
    Dim I, J As Integer

    J = 5

    For I = 1 TO J
    WRITECOLOREDLINE("BLUE", %BLUE)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("GREEN", %GREEN)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("CYAN", %CYAN)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("RED", %RED)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("MAGENTA", %MAGENTA)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("BROWN", %BROWN)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("WHITE", %WHITE)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("GRAY", %GRAY)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("LIGHT BLUE", %LIGHTBLUE)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("LIGHT GREEN", %LIGHTGREEN)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("LIGHT CYAN", %LIGHTCYAN)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("LIGHT RED", %LIGHTRED)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("LIGHT MAGENTA", %LIGHTMAGENTA)
    Next

    For I = 1 TO J
    WRITECOLOREDLINE("YELLOW", %YELLOW)
    Next

    For I = 1 To J
    WRITECOLOREDLINE("HI WHITE", %HIWHITE)
    Next

    WaitKey

    End Function

    '-------------------------------------------------------

    Function WRITECOLOREDLINE(TXT As String, CLR As Integer)
    Static L As Integer
    L = Console_GetCursorY()
    Console_WriteLine(TXT)
    Console_ColorAt(1, L + 1, 80, L + 2, CLR)
    End Function

    '-------------------------------------------------------
    [/code]
    Attached Files Attached Files
    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

Similar Threads

  1. colors and console_printat
    By sandyrepope in forum Console
    Replies: 4
    Last Post: 22-02-2007, 17:59

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •