Use pretty colours. More...
Macros | |
| #define | PP_BLACK "\x1B[30m" |
| Use the system black colour. More... | |
| #define | PP_BLUE "\x1B[34m" |
| Use the system blue colour. More... | |
| #define | PP_BOLD "\x1B[1m" |
| Bold terminal text. More... | |
| #define | PP_CALL PP_BOLD PP_IDENTIFIER |
| Colour for function calls. More... | |
| #define | PP_CONSTANT PP_GREEN |
| Colour for constants. More... | |
| #define | PP_CYAN "\x1B[36m" |
| Use the system cyan colour. More... | |
| #define | PP_GRAY PP_GREY |
| Alias for PP_GREY. More... | |
| #define | PP_GREEN "\x1B[32m" |
| Use the system green colour. More... | |
| #define | PP_GREY "\x1B[37m" |
| Use the system grey colour. More... | |
| #define | PP_IDENTIFIER PP_YELLOW |
| Colour for identifiers. More... | |
| #define | PP_KEYWORD PP_BOLD PP_BLUE |
| Colour for normal keywords (for, if, etc.) More... | |
| #define | PP_KEYWORD_NOT_WANTED PP_BOLD PP_RED |
| Colour for the keywords this program aims to remove (clocked, advance) More... | |
| #define | PP_KEYWORD_SPECIAL PP_BOLD PP_CYAN |
| Colour for special keywords (finish, async) More... | |
| #define | PP_PURPLE "\x1B[35m" |
| Use the system purple colour. More... | |
| #define | PP_RED "\x1B[31m" |
| Use the system red colour. More... | |
| #define | PP_RESET "\x1B[0m" |
| Reset terminal text modifications. More... | |
| #define | PP_YELLOW "\x1B[33m" |
| Use the system yellow colour. More... | |
Functions | |
| static void | pretty_print_color_disable (void) |
| Disable colours. More... | |
| static void | pretty_print_color_enable (void) |
| Enable colours. More... | |
| static bool | pretty_print_color_get_state (void) |
| Get the current colour state. More... | |
| static void | pretty_print_color_set_state (bool state) |
| Set the colour state. More... | |
| static bool | pretty_print_color_state (void) |
| Get the current colour state. More... | |
| void | pretty_print_colour_disable (void) |
| Disable colours. More... | |
| void | pretty_print_colour_enable (void) |
| Enable colours. More... | |
| static bool | pretty_print_colour_get_state (void) |
| Get the current colour state. More... | |
| void | pretty_print_colour_set_state (bool state) |
| Set the colour state. More... | |
| bool | pretty_print_colour_state (void) |
| Get the current colour state. More... | |
Use pretty colours.
1.0.0The pretty printing colour mode can be inspected using the pretty_print_colour_state() function.
It can be enabled with pretty_print_colour_enable() and disabled with pretty_print_colour_disable().
Several colours or modificators are defined using macros. Since C automatically concatenates strings, one can simply put these macros besides C strings. When attempting to use these macros, the user should first check whether the pretty printing colour mode is enabled.
It is also strongly advised to always add PP_RESET at the end of the strings, in order to make sure that any following text will be normal, unless this is not the desired behaviour.
| Modification | Macro | Text representation |
|---|---|---|
| Reset | PP_RESET | "\x1B[0m" |
| Bold | PP_BOLD | "\x1B[1m" |
| Modification | Macro | Text representation |
|---|---|---|
| Black | PP_BLACK | "\x1B[30m" |
| Red | PP_RED | "\x1B[31m" |
| Green | PP_GREEN | "\x1B[32m" |
| Yellow | PP_YELLOW | "\x1B[33m" |
| Blue | PP_BLUE | "\x1B[34m" |
| Purple | PP_PURPLE | "\x1B[35m" |
| Cyan | PP_CYAN | "\x1B[36m" |
| Grey | PP_GREY | "\x1B[37m" |
| Gray | PP_GRAY | "\x1B[37m" |
| #define PP_BLACK "\x1B[30m" |
#include <include/noclock/pretty_print.h>
Use the system black colour.
1.0.0 | #define PP_BLUE "\x1B[34m" |
#include <include/noclock/pretty_print.h>
Use the system blue colour.
1.0.0 | #define PP_BOLD "\x1B[1m" |
#include <include/noclock/pretty_print.h>
Bold terminal text.
1.0.0 | #define PP_CALL PP_BOLD PP_IDENTIFIER |
#include <include/noclock/pretty_print.h>
Colour for function calls.
1.0.0 | #define PP_CONSTANT PP_GREEN |
#include <include/noclock/pretty_print.h>
Colour for constants.
1.0.0 | #define PP_CYAN "\x1B[36m" |
#include <include/noclock/pretty_print.h>
Use the system cyan colour.
1.0.0 | #define PP_GRAY PP_GREY |
| #define PP_GREEN "\x1B[32m" |
#include <include/noclock/pretty_print.h>
Use the system green colour.
1.0.0 | #define PP_GREY "\x1B[37m" |
#include <include/noclock/pretty_print.h>
Use the system grey colour.
1.0.0 | #define PP_IDENTIFIER PP_YELLOW |
#include <include/noclock/pretty_print.h>
Colour for identifiers.
1.0.0 #include <include/noclock/pretty_print.h>
Colour for normal keywords (for, if, etc.)
1.0.0 #include <include/noclock/pretty_print.h>
Colour for the keywords this program aims to remove (clocked, advance)
1.0.0 #include <include/noclock/pretty_print.h>
Colour for special keywords (finish, async)
1.0.0 | #define PP_PURPLE "\x1B[35m" |
#include <include/noclock/pretty_print.h>
Use the system purple colour.
1.0.0 | #define PP_RED "\x1B[31m" |
#include <include/noclock/pretty_print.h>
Use the system red colour.
1.0.0 | #define PP_RESET "\x1B[0m" |
#include <include/noclock/pretty_print.h>
Reset terminal text modifications.
1.0.0 | #define PP_YELLOW "\x1B[33m" |
#include <include/noclock/pretty_print.h>
Use the system yellow colour.
1.0.0
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Disable colours.
1.0.0
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Enable colours.
1.0.0
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Get the current colour state.
1.0.0| true | if colours are enabled. |
| false | otherwise. |
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Set the colour state.
1.0.0| state | The desired colour state. |
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Get the current colour state.
1.0.0| true | if colours are enabled. |
| false | otherwise. |
| void pretty_print_colour_disable | ( | void | ) |
#include <include/noclock/pretty_print.h>
Disable colours.
1.0.0| void pretty_print_colour_enable | ( | void | ) |
#include <include/noclock/pretty_print.h>
Enable colours.
1.0.0
|
inlinestatic |
#include <include/noclock/pretty_print.h>
Get the current colour state.
1.0.0| true | if colours are enabled. |
| false | otherwise. |
| void pretty_print_colour_set_state | ( | bool | state | ) |
#include <include/noclock/pretty_print.h>
Set the colour state.
1.0.0| state | The desired colour state. |
| bool pretty_print_colour_state | ( | void | ) |
#include <include/noclock/pretty_print.h>
Get the current colour state.
1.0.0| true | if colours are enabled. |
| false | otherwise. |