alecAbstraction Layer for Escape Codes |
git clone git://git.dimitrijedobrota.com/alec.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
README.md (4927B)
0 # alec
2 Abstraction Layer for Escape Codes
4 ## Description
6 This project is a header-only library that allows for easy creation and usage
7 of ANSI Escape Codes from C++ project. It exports a set of template variables
8 to be used when the content is known at compile time, as well as a set of
9 functions to be used at run-time.
12 ## Dependencies
14 * CMake 3.14 or latter
15 * Compiler with C++20 support (tested on clang version 16.0.5)
18 ## Building and installing
20 See the [`BUILDING`](BUILDING.md) document.
23 ## Usage
25 > Please reference demo folder for relevant usage examples.
27 Everything that this library provide is found in `alec` namespace.
28 Functions have names shown in the table below, whilst templates have suffix _v
29 and don't need to be called.
31 ### Available functions with short explanation
33 | Name | parameters | Description |
34 |-------------------|---------------------|---------------------------------------------------|
35 | cursor_up | int cnt | Move cursor `cnt` lines up |
36 | cursor_down | int cnt | Move cursor `cnt` lines down |
37 | cursor_frwd | int cnt | Move cursor `cnt` lines left |
38 | cursor_back | int cnt | Move cursor `cnt` lines right |
39 | cursor_line_next | int cnt | Move cursor to beginning of line `cnt` lines down |
40 | cursor_line_prev | int cnt | Move cursor to beginning of line `cnt` lines up |
41 | cursor_column | int col | Set cursor to specific position on current line |
42 | cursor_position | int col, int row | Set cursor to specific position on screen |
43 | erase_display | Motion mtn | Erase in display mode |
44 | erase_line | Motion mtn | Erase in line mode |
45 | scroll_up | int cnt | Scroll whole page up by `cnt` |
46 | scroll_down | int cnt | Scroll whole page down by `cnt` |
47 | foreground | Color color | Set foreground to `color` |
48 | background | Color color | Set background to `color` |
49 | foreground | int idx | Set foreground to `idx` in 256 color pallet |
50 | background | int idx | Set background to `idx` in 256 color pallet |
51 | foreground | int R, int G, int B | Set foreground to `RGB` value |
52 | background | int R, int G, int B | Set background to `RGB` value |
53 | decor_set | Decor decor | Turn specific decoration on |
54 | decor_reset | Decor decor | Turn specific decoration of |
55 | cursor_save | | Saves cursor position |
56 | cursor_restore | | Restore cursor position |
57 | screen_mode_set | int mode | Changes screen width or type to `mode` |
58 | screen_mode_reset | int mode | Reset screen width or type to `mode` |
59 | screen_save | | Save screen |
60 | screen_restore | | Restore screen |
61 | cursor_show | | Show cursor |
62 | cursor_hide | | Hide cursor |
63 | abuf_enable | | Enable alternate screen buffer |
64 | abuf_disable | | Disable alternate screen buffer |
65 | paste_enable | | Turn on bracketed paste mode |
66 | paste_disable | | Turn off bracketed paste mode |
69 ### Enumeration
71 #### Motion
73 * END: erase from cursor until end of screen/line
74 * BEGIN: erase from cursor to beginning of screen/line
75 * WHOLE: erase entire screen/line
78 #### Color
80 * BLACK
81 * RED
82 * GREEN
83 * YELLOW
84 * BLUE
85 * MAGENTA
86 * CYAN
87 * WHITE
88 * DEFAULT
91 #### Decor
93 * RESET
94 * BOLD
95 * DIM
96 * ITALIC
97 * UNDERLINE
98 * BLINK
99 * INVERSE
100 * HIDE
101 * STRIKE
104 ## Contributing
106 See the [`CONTRIBUTING`](CONTRIBUTING.md) document.
109 ## Version History
111 * 0.2
112 * Drop generation phase
113 * Modernize codebase
114 * Basic user input facilities
115 * 0.1
116 * Initial development
119 ## License
121 This project is licensed under the MIT License - see the [`LICENSE`](LICENSE.md) file for details
123 ## References
125 * [`ANSI Escape Sequences gist`](https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797)
126 * [`Wikipedia article`](https://en.wikipedia.org/wiki/ANSI_escape_code)