Skip to content

Hackish library for terminal colors in writeln(...);

License

Notifications You must be signed in to change notification settings

vladdeSV/termcolor-d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

termcolor-d

colors

Hackish library use colors with writeln(...); on POSIX.

Examples

// all below retun ANSI color codes, which most terminals will interpret correctly

C.red.fg;       // Color → Red → Foreground
C.blueDark.bg;  // Color → Blue (Dark) → Background
C.reset.fg;     // Color → Default Color → Foreground
C.reset.bg;     // Color → Default Color → Background
resetColor;     // Reset foreground and background colors to default
import std.stdio : writeln;

writeln(C.green.fg, "Green text", resetColor);
writeln(C.blue.bg, "Blue", C.blueDark.bg, "Dark", resetColor);
writeln("Written in ", C.yellow.fg, "yellow color and ", C.blackDark.bg, "dark background", resetColor, "!");
/// dub.json
"dependencies": {
    "termcolor-d": "~>0.0.1",
    ...
}
/// dub.sdl
dependency "termcolor-d" version="~>0.0.1"

Shameless plugs (and other recommendations)

scone 🍞 by me - If you need a more fleshed out cross-platform library to handle text, colors, and keyboard input.

terminal.d by Adam D. Ruppe - A more lightweight cross-platform library to handle text, colors, and keyboard input.

textattr by Shriramana Sharma - Library with a different approach than this project, but with some more functionality. Available for other programming languages languages.

ConsoleD by Robert Pasińsk - Another cross-platform library with yet another approach than this project, and also has more functionality.

About

Hackish library for terminal colors in writeln(...);

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages