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