Files
CST-agent/vendor/sashidown/src/ansi_style.c
T
WHCandCursor 1f1fcba7ad Initial CST-Agent: portable Linux/Termux/Windows coding agent.
Vendored sashidown, OpenAI-compatible env (OPENAI_*), and bootstrap scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:42:32 +08:00

105 lines
2.5 KiB
C

#include "ansi_style.h"
#include <stddef.h>
/* Default colorful theme — 16-color SGR, widely supported. */
static const ansi_theme_t THEME_COLOR = {
.reset = "\033[0m",
.heading = {
NULL,
"\033[1;96m", /* h1 bright cyan */
"\033[1;94m", /* h2 bright blue */
"\033[1;92m", /* h3 bright green */
"\033[1;95m", /* h4 bright magenta */
"\033[1;93m", /* h5 bright yellow */
"\033[1;91m", /* h6 bright red */
},
.heading_end = "\033[0m",
.strong_on = "\033[1m",
.strong_off = "\033[22m",
.emph_on = "\033[3;33m", /* italic yellow */
.emph_off = "\033[23;39m",
.strike_on = "\033[9m",
.strike_off = "\033[29m",
.code_on = "\033[1;36m", /* bright cyan */
.code_off = "\033[22;39m",
.fence_on = "\033[32m", /* green */
.fence_off = "\033[0m",
.link_on = "\033[4;94m", /* underline bright blue */
.link_off = "\033[24;39m",
.url_on = "\033[2;36m", /* dim cyan */
.url_off = "\033[22;39m",
.image_on = "\033[95m",
.image_off = "\033[39m",
.bullet = "\033[93m• \033[0m",
.bullet_end = "",
.ol_on = "\033[93m",
.ol_off = "\033[0m",
.bq_prefix = "\033[2;35m│ \033[0m",
.th_on = "\033[1;96m",
.th_off = "\033[0m",
.sep = "\033[2m │ \033[0m",
.latex_on = "\033[95m",
.latex_off = "\033[39m",
};
/* Monochrome / attribute-only (previous behavior). */
static const ansi_theme_t THEME_PLAIN = {
.reset = "\033[0m",
.heading = {
NULL,
"\033[1m", "\033[1m", "\033[1m",
"\033[1m", "\033[1m", "\033[1m",
},
.heading_end = "\033[0m",
.strong_on = "\033[1m",
.strong_off = "\033[22m",
.emph_on = "\033[3m",
.emph_off = "\033[23m",
.strike_on = "\033[9m",
.strike_off = "\033[29m",
.code_on = "\033[7m",
.code_off = "\033[27m",
.fence_on = "\033[2m",
.fence_off = "\033[0m",
.link_on = "",
.link_off = "",
.url_on = "",
.url_off = "",
.image_on = "",
.image_off = "",
.bullet = "• ",
.bullet_end = "",
.ol_on = "",
.ol_off = "",
.bq_prefix = "\033[2m| \033[0m",
.th_on = "\033[1m",
.th_off = "\033[22m",
.sep = " | ",
.latex_on = "",
.latex_off = "",
};
const ansi_theme_t *ansi_theme_color(void)
{
return &THEME_COLOR;
}
const ansi_theme_t *ansi_theme_plain(void)
{
return &THEME_PLAIN;
}