Переглянути джерело

Make loops to test many colors

DricomDragon 5 роки тому
батько
коміт
c9400ef647
1 змінених файлів з 17 додано та 0 видалено
  1. 17 0
      colors/main.cpp

+ 17 - 0
colors/main.cpp

@@ -2,6 +2,10 @@
 
 using namespace std;
 
+inline void resetColor() {
+	cout << "\033[0;30m" << "\033[0;49m" ;
+}
+
 int main() {
 	cout << "Show colors" << endl;
 
@@ -22,6 +26,19 @@ int main() {
 	cout << "\033[1;33m" << "Yellow" << endl;
 	cout << "\033[0;37m" << "Light Gray" << endl;
 	cout << "\033[1;37m" << "White" << endl;
+	resetColor();
+
+	cout << endl << "Loop combinations" << endl;
+	for (int cat(0) ; cat <= 1 ; cat ++) {
+		for (int kind(3) ; kind <= 8 ; kind ++) {
+			for (int color(0); color <= 9; color ++) {
+				cout << cat << ';' << kind << color << endl;
+				cout << "\033[" << cat << ';' << kind << color << 'm';
+				cout << "Sample #|!0123456789AaBbCc" << endl;
+				resetColor();
+			}
+		}
+	}
 
 	cout << "End." << endl;