# Terminal Colors for Jai This is a small declarative library which allows you to create colorful terminal messages. Note, that Jai already provides a module for printing colors: `modules/Print_Color`. The differences are, that the builtin module prints the characters directly, where this library returns strings. APIs of this library also returning the amount of characters, which were used for representing the colors. Which makes it useful for CLI programs, that are aware of the terminal window width. The last thing: The builtin library uses a default color palette. Where this library extends it a bit more and allows you to use RGB values. ### Windows I don't develop for Windows, so I'm not sure if this library will work on it. But I don't mind supporting Windows, you can provide me more information or a patch. ## Usage Put the directory `termcolors` in your projects `modules` directory, or link it while building. ### Example ```plain #import "termcolors"; main :: () { termcolors_init_allocator_and_context(); // If you want, you can reset the library pool with this proc defer termcolors_reset_pool(); font style background color v v log(paint("FooBar", .BOLD, .BLACK, .WHITE)); ^ ^ text foreground color background color v log(paint_ex("FooBar", .[.BOLD, .UNDERLINE, .ITALIC], 84, 124)); ^ ^ ^ text multiple font styles foreground 256bit color } ``` ### More Information There are several APIs and overloads, which are ranging from static/more declarative, to flexible/fully customizable. Please consult `termcolors/lib.jai` for a more detailed documentation. You can also view `test/test.jai` for more examples. If you want to run those examples, execute them with `jai build.jai - run silent`. ## Credits - https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences