+ 2

Help - Color Problem in CppDroid

Im currently trying to get a hang of ANSI escape sequences as ncurses library is not there in CppDroid, but the basic linux functions seems to work there... So I tried these codes: #include<iostream> using namespace std; int main() { cout<<"\033[30;43mHello"; } This printed Black Text on a Yellow Background, exactly what I wanted. Now I applied bold as well using 1; But in this: #include<iostream> using namespace std; int main() { cout<<"\033[1;30;43mHello"; } The text is shown in gray color. Why?

17th Jun 2017, 9:14 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
8 Respuestas
17th Jun 2017, 9:06 PM
Wojciech Bruski
Wojciech Bruski - avatar
+ 4
I don't know how it works but i tried with it. #include <iostream> #include <sstream> // cout << "\033[1;30;45mWord" << endl; using namespace std; int main() { for(int i=0 ; i<101 ; i++) { for(int j=0 ; j<101 ; j++) { stringstream ss; ss << "\033[" << i << ";" << j << "mWord" << endl; cout << i << "\t" << j << "\t" << ss.str() << endl; } } return 0; } This is fuckin magic
17th Jun 2017, 9:02 PM
Wojciech Bruski
Wojciech Bruski - avatar
+ 4
Thank You!
18th Jun 2017, 12:44 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 4
"\033[1;30;7;32m" try with it ;)
18th Jun 2017, 1:25 PM
Wojciech Bruski
Wojciech Bruski - avatar
+ 4
Its working! Thank You!
18th Jun 2017, 1:41 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
@Kinshuk Vasishit On the page is " \033[1;#m - makes colored text bold** " and then **(this could be usefull for those who want more colors. The efect given by bold will give a color change effect) so color of the text is other
18th Jun 2017, 12:21 PM
Wojciech Bruski
Wojciech Bruski - avatar
+ 3
Yes I understood that. But if black is changed to dark gray, is there some color which is changed to black? Ill try with the loops then. Thank you Again!
18th Jun 2017, 1:15 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
Unfortunately, my problem is still unsolved... But the link you shared has the explanation that bold manipulates colors to some extent. So, now, Is there a way to maintain the black color with bold, without letting it change to gray?
18th Jun 2017, 12:12 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar