|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
Color scheme management implementation and early initialization. More...
Go to the source code of this file.
Macros | |
| #define | NUM_BUILTIN_SCHEMES (sizeof(BUILTIN_SCHEMES) / sizeof(BUILTIN_SCHEMES[0])) |
Functions | |
| asciichat_error_t | colorscheme_init (void) |
| void | colorscheme_cleanup_compiled (compiled_color_scheme_t *compiled) |
| void | colorscheme_destroy (void) |
| const color_scheme_t * | colorscheme_get_active_scheme (void) |
| asciichat_error_t | colorscheme_set_active_scheme (const char *name) |
| asciichat_error_t | colorscheme_load_builtin (const char *name, color_scheme_t *scheme) |
| asciichat_error_t | colorscheme_load_from_file (const char *path, color_scheme_t *scheme) |
| asciichat_error_t | parse_hex_color (const char *hex, uint8_t *r, uint8_t *g, uint8_t *b) |
| void | rgb_to_truecolor_ansi (uint8_t r, uint8_t g, uint8_t b, char *buf, size_t size) |
| asciichat_error_t | colorscheme_compile_scheme (const color_scheme_t *scheme, terminal_color_mode_t mode, terminal_background_t background, compiled_color_scheme_t *compiled) |
| asciichat_error_t | colorscheme_export_scheme (const char *scheme_name, const char *file_path) |
| terminal_background_t | detect_terminal_background (void) |
| asciichat_error_t | options_colorscheme_init_early (int argc, const char *const argv[]) |
| Initialize color scheme early (before logging) | |
Variables | |
| mutex_t | g_colorscheme_mutex = PTHREAD_MUTEX_INITIALIZER |
Color scheme management implementation and early initialization.
Implements color scheme selection, loading, and compilation for ascii-chat. Supports built-in themes, TOML configuration files, and early initialization before logging starts.
Definition in file colorscheme.c.
| #define NUM_BUILTIN_SCHEMES (sizeof(BUILTIN_SCHEMES) / sizeof(BUILTIN_SCHEMES[0])) |
Definition at line 247 of file colorscheme.c.
| void colorscheme_cleanup_compiled | ( | compiled_color_scheme_t * | compiled | ) |
Definition at line 313 of file colorscheme.c.
Referenced by colorscheme_compile_scheme(), and log_cleanup_colors().
| asciichat_error_t colorscheme_compile_scheme | ( | const color_scheme_t * | scheme, |
| terminal_color_mode_t | mode, | ||
| terminal_background_t | background, | ||
| compiled_color_scheme_t * | compiled | ||
| ) |
Definition at line 539 of file colorscheme.c.
References colorscheme_cleanup_compiled(), rgb_to_16color(), rgb_to_256color(), rgb_to_truecolor_ansi(), and safe_snprintf().
Referenced by log_init_colors(), and log_set_color_scheme().
| void colorscheme_destroy | ( | void | ) |
Definition at line 337 of file colorscheme.c.
References g_colorscheme_mutex, and mutex_destroy().
Referenced by asciichat_shared_destroy().
| asciichat_error_t colorscheme_export_scheme | ( | const char * | scheme_name, |
| const char * | file_path | ||
| ) |
Definition at line 628 of file colorscheme.c.
References colorscheme_load_builtin(), file_path, platform_fopen(), and safe_snprintf().
| const color_scheme_t * colorscheme_get_active_scheme | ( | void | ) |
Definition at line 360 of file colorscheme.c.
References colorscheme_init().
Referenced by log_init_colors(), and options_init().
| asciichat_error_t colorscheme_init | ( | void | ) |
Definition at line 278 of file colorscheme.c.
References g_colorscheme_mutex, and mutex_init().
Referenced by colorscheme_get_active_scheme(), colorscheme_set_active_scheme(), and options_colorscheme_init_early().
| asciichat_error_t colorscheme_load_builtin | ( | const char * | name, |
| color_scheme_t * | scheme | ||
| ) |
Definition at line 404 of file colorscheme.c.
Referenced by colorscheme_export_scheme(), and main().
| asciichat_error_t colorscheme_load_from_file | ( | const char * | path, |
| color_scheme_t * | scheme | ||
| ) |
Definition at line 418 of file colorscheme.c.
References parse_hex_color().
Referenced by colorscheme_set_active_scheme().
| asciichat_error_t colorscheme_set_active_scheme | ( | const char * | name | ) |
Definition at line 369 of file colorscheme.c.
References colorscheme_init(), colorscheme_load_from_file(), and g_colorscheme_mutex.
Referenced by options_colorscheme_init_early(), and options_init().
| terminal_background_t detect_terminal_background | ( | void | ) |
Definition at line 697 of file colorscheme.c.
References platform_strcasecmp(), and terminal_has_dark_background().
Referenced by log_init_colors(), and log_set_color_scheme().
| asciichat_error_t options_colorscheme_init_early | ( | int | argc, |
| const char *const | argv[] | ||
| ) |
Initialize color scheme early (before logging)
| argc | Argument count |
| argv | Argument array |
This function is called from main() BEFORE log_init() to apply color scheme to logging before any log messages are printed.
Priority order:
Definition at line 793 of file colorscheme.c.
References colorscheme_init(), and colorscheme_set_active_scheme().
Referenced by main().
| asciichat_error_t parse_hex_color | ( | const char * | hex, |
| uint8_t * | r, | ||
| uint8_t * | g, | ||
| uint8_t * | b | ||
| ) |
Definition at line 497 of file colorscheme.c.
Referenced by colorscheme_load_from_file().
| void rgb_to_truecolor_ansi | ( | uint8_t | r, |
| uint8_t | g, | ||
| uint8_t | b, | ||
| char * | buf, | ||
| size_t | size | ||
| ) |
Definition at line 529 of file colorscheme.c.
References safe_snprintf().
Referenced by colorscheme_compile_scheme().
| mutex_t g_colorscheme_mutex = PTHREAD_MUTEX_INITIALIZER |
Definition at line 38 of file colorscheme.c.
Referenced by colorscheme_destroy(), colorscheme_init(), colorscheme_set_active_scheme(), log_init_colors(), and log_set_color_scheme().