Package ch.autumo.commons.console
Class Colors
java.lang.Object
ch.autumo.commons.console.Colors
ANSI Colors.
To activate ANSI colors in Windows:
- CMD and PowerShell: "reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1"
- PowerShell: "Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1"
- You also could download the Windows Terminal: Windows Terminal
See also: https://stackoverflow.com/questions/51680709/colored-text-output-in-powershell-console-using-ansi-vt100-codes/51681675#51681675
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringBlack colored string.static StringCyan colored string.static StringDark-Black colored string.static StringDark-Cyan colored string.static StringDark-Green colored string.static StringdarkMangenta(String text) Dark-Mangenta colored string.static StringDark-Red colored string.static StringDark-White colored string.static StringdarkYellow(String text) Dark-Yellow colored string.static StringforegroundColorize(String text, com.diogonunes.jcolor.Attribute attribute) Colorize text.static StringGreen colored string.static StringMangenta colored string.static StringOrange colored string.static StringRed colored string.static StringWhite colored string.static StringYellow colored string.
-
Method Details
-
foregroundColorize
Colorize text.- Parameters:
text- text to colorizeattribute- color attribute- Returns:
- ANSI colored text
-
black
Black colored string.- Parameters:
text- text- Returns:
- colored string
-
darkBlack
Dark-Black colored string.- Parameters:
text- text- Returns:
- colored string
-
white
White colored string.- Parameters:
text- text- Returns:
- colored string
-
darkWhite
Dark-White colored string.- Parameters:
text- text- Returns:
- colored string
-
mangenta
Mangenta colored string.- Parameters:
text- text- Returns:
- colored string
-
darkMangenta
Dark-Mangenta colored string.- Parameters:
text- text- Returns:
- colored string
-
cyan
Cyan colored string.- Parameters:
text- text- Returns:
- colored string
-
darkCyan
Dark-Cyan colored string.- Parameters:
text- text- Returns:
- colored string
-
green
Green colored string.- Parameters:
text- text- Returns:
- colored string
-
darkGreen
Dark-Green colored string.- Parameters:
text- text- Returns:
- colored string
-
yellow
Yellow colored string.- Parameters:
text- text- Returns:
- colored string
-
darkYellow
Dark-Yellow colored string.- Parameters:
text- text- Returns:
- colored string
-
red
Red colored string.- Parameters:
text- text- Returns:
- colored string
-
darkRed
Dark-Red colored string.- Parameters:
text- text- Returns:
- colored string
-
orange
Orange colored string. Unsupported by most terminals.- Parameters:
text- text- Returns:
- colored string
-