Small Basic – TextWindow Colors

In Small Basic, you can change the background and foreground colors of the text window's output text using the BackgroundColor and ForegroundColor properties of TextWindow.

You specify the desired color by number or by name. The permissible values are shown here:

Figure: The available TextWindow colors

For example, to output your text in yellow, you can use the word "Yellow" or the number 14:

TextWindow.ForegroundColor = "Yellow"  ' Uses color name

TextWindow.ForegroundColor = 14             ' Uses color number

Have a Small and Basic week!

   - Ninja Ed & Majed Marji

See Also

Comments (8)

  1. litdev says:

    You can change the entire TextWindow background colour by doing a Clear after setting the background colour.

    TextWindow.BackgroundColor = "Red"


  2. anonymouscommenter says:

    How would i make an orange background ?


    would be simple but does not work ?

    maybe in next version of Small Basic , it would be great to add those simple colors to the basic colors:

    Orange, Brown, LightGray, MidBlue, MidGreen, MidRed

  3. litdev says:

    You can't – the TextWindow is a DOS type Console and the colours are defined by 4 bits (0-15) hence only 16 uique colours.

    It may be possible  to change the colours assignd to the 16, but not in SB without some extenson to do something like this:…/orange-text-color-in-c-sharp-console-application

  4. anonymouscommenter says:

    here is a way i found for a pseudo orange background, if i set 1 pixels red and the next pixels yellow, and so on we will have the impression of an orange background, it works !! It is an old technical of dot printing

    graphicsWindow.Clear() ' cls

    GraphicsWindow.Title = "pseudo orange background" 0

    GraphicsWindow.left= 0

    GraphicsWindow.Height = 768

    GraphicsWindow.Width = 1366

    While y < 768

    For x= 1 To 1366 Step 2






  5. litdev says:

    That is the GraphicsWindow which we ca set to any colour directly, the 16 colours limit is for the Textindow.

    GraphicsWindow.BackgroundColor = "Orange"


    GraphicsWindow.BackgroundColor = "#FFA500"

  6. That's a great point, LitDev (your first post). Thanks!

  7. SchDon says:

    Can I write colored text to a text file (.CSV, .TXT, or .RTF) using Small Basic?

Skip to main content