Qbasic Color statement is used to change the Foreground and the background color of the Text in the QBasic Program. The Syntax is COLOR foreground, background
The word foreground color means the color of the text and background color means a color that appears behind the text.
You can use the COLOR statement in Qbasic in the following ways:
COLOR [foreground color] , [background color]
Use a comma to separate the foreground and the background color.
COLOR 14, 1
PRINT Yellow text with blue background
PRINT “This is the green text”
COLOR , [background]
Use a comma after the COLOR command and then your background color code
PRINT “this is the blue background”
If you want to change the entire background color of the screen, use CLS command after setting the background color.
COLOR 14, 1
PRINT “Yellow text with entire screen blue background”
The foreground and the background color are represented by numbers in Qbasic. You can use the qbasic color codes to change the color according to your preferences:
There are 16 colors (in screen mode 0), numbered from 0 to 15.
You can see from the color code table that there are 8 main colors(from 0 to 7), and the color from 8 to 15 are just the repetitions of color from 1 to 7 but in a lighter shade. The colors are a combination of binary values (blue = 1, green = 2, red = 4), which makes it easier to memorize the color codes.
If you want blinking color, it is available from color code 16 to 31. At 16, the color starts again with blicking black color and ends with blinking white at 31. The blinking option is not available for the background, it only works for the foreground color(text color). Here the example how to get the blinking color code = 2 (green color code ) + 16 = 18( blinking green color), 4(red color code) + 16 = 20 (blinking red color).
QBASIC stands for “**Quick Beginners All-Purpose Symbolic Instruction Code**”. QBASIC was developed by [Microsoft Corporation](https://en.wikipedia.org/wiki/Microsoft) in the year 1991. It is considered to be one of the most easy-to-understand programming languages for beginners.
QBasic programming examples and exercises for class 6 and class 7 standard.These Qbasic program examples are a beginner-level, which mostly will help you to understand the concept of a variable and some basic qbasic statements like PRINT, INPUT, CLS etc.
If you are searching for Qbasic commands for class 6 or Qbasic statements for class 7, then this is the right article for you. Here we will discuss those basic commands and statements which will help you to understand the concept of how a computer understands what you have programmed.