Skip to content
Sign upLog in
← Back to Community

Java Colors

Profile icon
Bunnytoes

I wanted to set the color for the text in java and I got it to get a color, but now I want to set the color, but java doesn't have a SystemColor.setColor(); but it has a SystemColor.getColor();, how can I get it to work?

Voters
Profile icon
TheeranSrikanth
Profile icon
Bunnytoes
Comments
hotnewtop
Profile icon
Coder100

Use escape codes instead.

System.out.println("\x1b[1mbold text\x1b[0m");

https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

Profile icon
Bunnytoes

@Coder100
ok, thanks edit: it doesn't work