Color Code in C++
A color code is a way to describe and encode non-color knowledge using colors to make interaction easier. Although it can also be chronological (indicating an ordered/quantitative quantity), this data is typically classified (which symbolizes unordered/qualitative groupings).
History:
Color codes were first used for distant communication flag-based exchanges, similar to telegraph communication. For this kind of communication, the British government developed a color-coding system in which red and white stood for danger and safety, respectively, with other hues possessing comparable meanings.
Coloration was used as an alert to differentiate objects that could have been ambiguously similar, such as medicinal capsules and electrical and gadget cabling, as techniques in biochemistry and other fields advanced.
Encoded Variable:
A color code corresponds to the type of the parameter it encodes, even though the parameter itself may have multiple representations:
- Categorical variables:
These variables can describe discrete quantities of qualitative information that is not requested, such as ethnicity.
Usually, binary variables are managed as category factors.
- Quantitative variable:
The variable shows information that is arranged and quantified.
- Discrete quantitative information
Despite their ordered character, discrete quantitative information (such as the six sides of a die, 1, 2, 3, 5, and 6) are occasionally handled as categories.
Classification
The various types of color coding are as follows:
- Categorical: The colors are selected to optimize the difference in color among every one of the color pair combinations, hence increasing prominence of the colors, even though they are not organized.
- Continuous: a seamless color gradation formed by the arranged colors.
- Discrete: a small part of a continuous color code, all of which can be distinguished from the remainder, is utilized (while maintaining order).
Analysis:
The color coding is single-dimensional, where only a single variable is color. The code becomes multiple when other characteristics, like shape or size, are changed. These dimensions may be repetitive (encoding the identical variable) or autonomous (each coding independent variable). A single factor is viewed as an element of a different one in incomplete redundancy. As an illustration, the colors and shapes of the engaging game suits—club, the diamond, heart, and spade—are multidimensional as well as somewhat repetitive because the spade, as well as clubs, constantly turn black while diamonds along with hearts are constantly red. Qualitative color-coding tasks are under the category of recognition tasks because they only need the identification of one input. Activities utilizing categorization color coding fall into two categories: exploration duties, in which a color stimuli needs to be located among an assortment of heterogeneous stimuli, and recognition tasks, in which only one stimulus is presented and must be located (connotatively or denotatively).
When using C++ programming, the resultant screen's backdrop is black, and the written content is colored white. The subsequent methods allow us to customize the final screen's background and text colors. These tasks are scored based on accuracy and or speed.
Depending on whether correctness or quickness is more important, the categorical color code's optimal color scheme will vary. Evidence suggests that coloring strategies during which colors differ solely in color ought to be limited to the greatest of eight groups with tailored stimulation spacing together the shade dimension, even though this wouldn't be available for color-blind people. This is even though humans can distinguish 150 dollars' colors along the hue dimensions during a comparison task. The seven hues the IALA suggests using for categorization color coding are red, orange, yellow, green, blue, white, and black. Repetitive brightness and colorfulness programming add data that improve task efficiency and precision for color decoding.
Header File:
#include <windows.h>
or
#include <stdlib.h>
Syntax:
system("Color XY")
In the previously mentioned command, modify the numerical value X of the preceding syntax to the desired background color with the variable Y of the syntax as mentioned earlier to the desired text color.
Example Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
system("Color B5");
cout << "Lara";
system("Color 16");
cout << " For ";
system("Color DE");
cout << "Jean";
return 0;
}
Output:
C++ table for color permissions:
Color ID | Color | Color id | Color |
1 | Blue | 9 | Blue |
2 | Green | 0 | Black |
3 | Aqua | A | Light Green |
4 | Red | B | Light Aqua |
5 | Purple | C | Light Red |
6 | Yellow | D | Light Purple |
7 | Gray | F | Bright White |
8 | White | E | Light Yellow |