All Projects → dialex → Jcolor

dialex / Jcolor

Licence: mit
An easy syntax to format your strings with colored fonts and backgrounds.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jcolor

log-utils
Basic logging utils: colors, symbols and timestamp.
Stars: ✭ 24 (-90.59%)
Mutual labels:  log, ansi, ansi-colors
Ololog
A better console.log for the log-driven debugging junkies
Stars: ✭ 141 (-44.71%)
Mutual labels:  log, ansi, ansi-colors
Airshare
Cross-platform content sharing in a local network
Stars: ✭ 497 (+94.9%)
Mutual labels:  utilities, cross-platform
Env Cmd
Setting environment variables from a file
Stars: ✭ 969 (+280%)
Mutual labels:  utilities, cross-platform
kotter
A declarative, Kotlin-idiomatic API for writing dynamic console applications.
Stars: ✭ 355 (+39.22%)
Mutual labels:  ansi, ansi-colors
Catsay
A program that generates pictures of a cat holding a sign with a message.
Stars: ✭ 85 (-66.67%)
Mutual labels:  cross-platform, ascii-art
Asciimatics
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Stars: ✭ 2,869 (+1025.1%)
Mutual labels:  cross-platform, ascii-art
Ubelt
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!
Stars: ✭ 561 (+120%)
Mutual labels:  utilities, cross-platform
ansi-php
ANSI Control Functions and ANSI Control Sequences (Colors, Erasing, etc.) for PHP CLI Apps
Stars: ✭ 82 (-67.84%)
Mutual labels:  ansi, ansi-colors
ansiart2utf8
Processes legacy BBS-style ANSI art (ACiDDraw, PabloDraw, etc.) to UTF-8. Escape codes and line endings are processed for terminal friendliness.
Stars: ✭ 32 (-87.45%)
Mutual labels:  ansi, ansi-colors
kolorist
A tiny utility to colorize stdin/stdout
Stars: ✭ 160 (-37.25%)
Mutual labels:  ansi, ansi-colors
Plog
Portable, simple and extensible C++ logging library
Stars: ✭ 1,061 (+316.08%)
Mutual labels:  cross-platform, log
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (+16.08%)
Mutual labels:  cross-platform, ascii-art
Mars
Mars is a cross-platform network component developed by WeChat.
Stars: ✭ 15,912 (+6140%)
Mutual labels:  cross-platform, log
gitlab-job-log-viewer
Browser extension for code highlighting raw logs in Gitlab CI
Stars: ✭ 21 (-91.76%)
Mutual labels:  ansi, ansi-colors
Blockzone
A faithful recreation of the original DOS font.
Stars: ✭ 100 (-60.78%)
Mutual labels:  ascii-art, ansi
Cfonts
Sexy fonts for the console
Stars: ✭ 789 (+209.41%)
Mutual labels:  ascii-art, ansi
Retrotxt
RetroTxt is the WebExtension that turns ANSI, ASCII, NFO text into in-browser HTML
Stars: ✭ 93 (-63.53%)
Mutual labels:  ascii-art, ansi
ansicolor
A JavaScript ANSI color/style management. ANSI parsing. ANSI to CSS. Small, clean, no dependencies.
Stars: ✭ 91 (-64.31%)
Mutual labels:  ansi, ansi-colors
durdraw
Animated Unicode, ANSI and ASCII Art Editor for Linux/Unix/macOS
Stars: ✭ 55 (-78.43%)
Mutual labels:  ansi, ascii-art

Travis build Maven Central Codacy Badge License Donate

JColor (formerly Java Colored Debug Printer) offers you an easy syntax to print messages with a colored font or background on a terminal.

Screenshots

JColor running on iTerm (macOS)

How it looks on different platforms: macOS iTerm (above), Windows 10 PowerShell 6, Windows 10 Console, IntelliJ

Usage

The screenshot was the result of running this demo code:

// Use Case 1: use Ansi.colorize() to format inline
System.out.println(colorize("This text will be yellow on magenta", YELLOW_TEXT(), MAGENTA_BACK()));
System.out.println("\n");

// Use Case 2: compose Attributes to create your desired format
Attribute[] myFormat = new Attribute[]{RED_TEXT(), YELLOW_BACK(), BOLD()};
System.out.println(colorize("This text will be red on yellow", myFormat));
System.out.println("\n");

// Use Case 3: AnsiFormat is syntactic sugar for an array of Attributes
AnsiFormat fWarning = new AnsiFormat(GREEN_TEXT(), BLUE_BACK(), BOLD());
System.out.println(colorize("AnsiFormat is just a pretty way to declare formats", fWarning));
System.out.println(fWarning.format("...and use those formats without calling colorize() directly"));
System.out.println("\n");

// Use Case 4: you can define your formats and use them throughout your code
AnsiFormat fInfo = new AnsiFormat(CYAN_TEXT());
AnsiFormat fError = new AnsiFormat(YELLOW_TEXT(), RED_BACK());
System.out.println(fInfo.format("This info message will be cyan"));
System.out.println("This normal message will not be formatted");
System.out.println(fError.format("This error message will be yellow on red"));
System.out.println("\n");

// Use Case 5: we support bright colors
AnsiFormat fNormal = new AnsiFormat(MAGENTA_BACK(), YELLOW_TEXT());
AnsiFormat fBright = new AnsiFormat(BRIGHT_MAGENTA_BACK(), BRIGHT_YELLOW_TEXT());
System.out.println(fNormal.format("You can use normal colors ") + fBright.format(" and bright colors too"));

// Use Case 6: we support 8-bit colors
System.out.println("Any 8-bit color (0-255), as long as your terminal supports it:");
for (int i = 0; i <= 255; i++) {
    Attribute txtColor = TEXT_COLOR(i);
    System.out.print(colorize(String.format("%4d", i), txtColor));
}
System.out.println("\n");

// Use Case 7: we support true colors (RGB)
System.out.println("Any TrueColor (RGB), as long as your terminal supports it:");
for (int i = 0; i <= 300; i++) {
    Attribute bkgColor = BACK_COLOR(randomInt(255), randomInt(255), randomInt(255));
    System.out.print(colorize("   ", bkgColor));
}
System.out.println("\n");

// Credits
System.out.print("This example used JColor 5.0.0   ");
System.out.print(colorize("\tMADE ", BOLD(), BRIGHT_YELLOW_TEXT(), GREEN_BACK()));
System.out.println(colorize("IN PORTUGAL\t", BOLD(), BRIGHT_YELLOW_TEXT(), RED_BACK()));
System.out.println("I hope you find it useful ;)");

Installation

You can import this dependency through Maven or Gradle:

  • JColor v5.* supports Java +8, Linux, macOS, Windows 10
  • JCDP v4.* supports Java +8, Linux, macOS, Windows 10
  • JCDP v3.* supports Java +8, Linux, macOS, Windows
  • JCDP v2.* supports Java +6, Linux, macOS, Windows

Useful links

License

JColor, former JCDP Copyright (C) 2011-* Diogo Nunes This program is licensed under the terms of the MIT License and it comes with ABSOLUTELY NO WARRANTY. For more details check LICENSE.

Credits

A big thanks to all contributors, namely @xafero who maven-ized this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].