GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java-Program/Text_Color.java at main · PP-Namias/Java-Program

Expand file tree

/

Text_Color.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
44 lines (39 loc) · 1.55 KB
/

Text_Color.java

Copy path

File metadata and controls

44 lines (39 loc) · 1.55 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Java Program to Print Colored Text in Console
// Importing input output classes
// Main class
public class Text_Color {
// Declaring ANSI_RESET so that we can reset the color
public static final String ANSI_RESET = "\u001B[0m";
// Declaring the color
// Custom declaration
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_WHITE = "\u001B[37m";
// Main driver method
public static void main(String[] args) {
// Printing the text on console prior adding
// the desired color
System.out.println(ANSI_BLACK
+ "This text is BLACK");
System.out.println(ANSI_RED
+ "This text is RED");
System.out.println(ANSI_GREEN
+ "This text is GREEN");
System.out.println(ANSI_YELLOW
+ "This text is YELLOW");
System.out.println(ANSI_BLUE
+ "This text is BLUE");
System.out.println(ANSI_PURPLE
+ "This text is PURPLE");
System.out.println(ANSI_CYAN
+ "This text is CYAN");
System.out.println(ANSI_WHITE
+ "This text is WHITE"
+ ANSI_RESET);
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.