Package com.xpdustry.ansi
Class Ansi
java.lang.Object
mindustry.mod.Mod
mindustry.mod.Plugin
com.xpdustry.ansi.Ansi
public class Ansi
extends mindustry.mod.Plugin
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final inthttps://learn.microsoft.com/en-us/windows/console/setconsolemodestatic final inthttps://learn.microsoft.com/en-us/windows/console/setconsolemode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanenable()Enable ANSI escape codes (VT100 for windows) for all console handles (STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE).static booleanenable(int hConsoleHandle) Enable ANSI escape codes (VT100 for windows).static Stringstatic voidinstall()Enables ANSI colors and resets escapes codes.static voidResetsColorCodesfields.Methods inherited from class mindustry.mod.Mod
getConfig, init, loadContent, registerClientCommands, registerServerCommands
-
Field Details
-
ENABLE_PROCESSED_OUTPUT
public static final int ENABLE_PROCESSED_OUTPUThttps://learn.microsoft.com/en-us/windows/console/setconsolemode- See Also:
-
ENABLE_VIRTUAL_TERMINAL_PROCESSING
public static final int ENABLE_VIRTUAL_TERMINAL_PROCESSINGhttps://learn.microsoft.com/en-us/windows/console/setconsolemode- See Also:
-
-
Constructor Details
-
Ansi
public Ansi()
-
-
Method Details
-
install
public static void install()Enables ANSI colors and resets escapes codes.
Does nothing if it's not Windows or if it's the Windows Terminal, which already support colors. -
enable
public static boolean enable()Enable ANSI escape codes (VT100 for windows) for all console handles (STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE).- Returns:
- whether the operation has been performed successfully.
- See Also:
-
enable
public static boolean enable(int hConsoleHandle) Enable ANSI escape codes (VT100 for windows).- Parameters:
hConsoleHandle- the console handle (STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE).- Returns:
- whether the operation has been performed successfully.
- See Also:
-
getLastError
- Returns:
- a formatted message of the last Windows error.
-
resetColorCodes
public static void resetColorCodes()ResetsColorCodesfields.
-