Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QcmpCompressionLibrary
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
QcmpCompressionLibrary
Commits
d2667c64
"git@code.it4i.cz:fiji/hpc-workflow-manager.git" did not exist on "ad496cff4e6b1b145fedc1d1d80992869742149b"
Commit
d2667c64
authored
4 years ago
by
Vojtech Moravec
Browse files
Options
Downloads
Patches
Plain Diff
Colored console output utility.
parent
84cd8992
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/azgracompress/utilities/ColorConsole.java
+50
-0
50 additions, 0 deletions
src/main/java/azgracompress/utilities/ColorConsole.java
with
50 additions
and
0 deletions
src/main/java/azgracompress/utilities/ColorConsole.java
0 → 100644
+
50
−
0
View file @
d2667c64
package
azgracompress.utilities
;
public
final
class
ColorConsole
{
private
static
final
String
ANSI_RESET
=
"\u001B[0m"
;
private
static
final
String
ANSI_BLACK
=
"\u001B[30m"
;
private
static
final
String
ANSI_RED
=
"\u001B[31m"
;
private
static
final
String
ANSI_GREEN
=
"\u001B[32m"
;
private
static
final
String
ANSI_YELLOW
=
"\u001B[33m"
;
private
static
final
String
ANSI_BLUE
=
"\u001B[34m"
;
private
static
final
String
ANSI_PURPLE
=
"\u001B[35m"
;
private
static
final
String
ANSI_CYAN
=
"\u001B[36m"
;
private
static
final
String
ANSI_WHITE
=
"\u001B[37m"
;
public
enum
Color
{
Black
,
Red
,
Green
,
Yellow
,
Blue
,
Purple
,
Cyan
,
White
}
public
enum
Target
{
stdout
,
stderr
}
private
static
String
getColor
(
final
Color
color
)
{
switch
(
color
)
{
case
Black:
return
ANSI_BLACK
;
case
Red:
return
ANSI_RED
;
case
Green:
return
ANSI_GREEN
;
case
Yellow:
return
ANSI_YELLOW
;
case
Blue:
return
ANSI_BLUE
;
case
Purple:
return
ANSI_PURPLE
;
case
Cyan:
return
ANSI_CYAN
;
default
:
return
ANSI_WHITE
;
}
}
public
static
void
fprintf
(
final
Target
target
,
final
Color
color
,
final
String
format
,
final
Object
...
args
)
{
switch
(
target
)
{
case
stdout:
System
.
out
.
println
(
getColor
(
color
)
+
String
.
format
(
format
,
args
)
+
ANSI_RESET
);
break
;
case
stderr:
System
.
err
.
println
(
getColor
(
color
)
+
String
.
format
(
format
,
args
)
+
ANSI_RESET
);
break
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment