Add dynamic color enum defines to shader

This commit is contained in:
Kovid Goyal 2025-08-26 12:55:04 +05:30
parent c18018cbad
commit b38be3005c
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,10 @@
#define MARK_MASK {MARK_MASK}
#define USE_SELECTION_FG
#define NUM_COLORS 256
#define COLOR_NOT_SET {COLOR_NOT_SET}
#define COLOR_IS_SPECIAL {COLOR_IS_SPECIAL}
#define COLOR_IS_RGB {COLOR_IS_RGB}
#define COLOR_IS_INDEX {COLOR_IS_INDEX}
#if {ONLY_BACKGROUND} == 1
#define ONLY_BACKGROUND

View file

@ -860,6 +860,10 @@ PyInit_fast_data_types(void) {
PyModule_AddIntMacro(m, ESC_DCS);
PyModule_AddIntMacro(m, ESC_PM);
PyModule_AddIntMacro(m, TEXT_SIZE_CODE);
PyModule_AddIntMacro(m, COLOR_NOT_SET);
PyModule_AddIntMacro(m, COLOR_IS_SPECIAL);
PyModule_AddIntMacro(m, COLOR_IS_INDEX);
PyModule_AddIntMacro(m, COLOR_IS_RGB);
#ifdef __APPLE__
// Apple says its SHM_NAME_MAX but SHM_NAME_MAX is not actually declared in typical CrApple style.
// This value is based on experimentation and from qsharedmemory.cpp in Qt

View file

@ -16,6 +16,10 @@ from kitty.typing_compat import EdgeLiteral, NotRequired, ReadableBuffer, Writea
SCALE_BITS: int
WIDTH_BITS: int
SUBSCALE_BITS: int
COLOR_IS_SPECIAL: int
COLOR_NOT_SET: int
COLOR_IS_RGB: int
COLOR_IS_INDEX: int
GLFW_LAYER_SHELL_NONE: int
GLFW_LAYER_SHELL_PANEL: int
GLFW_LAYER_SHELL_TOP: int

View file

@ -15,6 +15,10 @@
CELL_BG_PROGRAM,
CELL_FG_PROGRAM,
CELL_PROGRAM,
COLOR_IS_INDEX,
COLOR_IS_RGB,
COLOR_IS_SPECIAL,
COLOR_NOT_SET,
DECORATION,
DECORATION_MASK,
DIM,
@ -178,6 +182,10 @@ def __call__(self, allow_recompile: bool = False) -> None:
MARK_SHIFT=MARK,
MARK_MASK=MARK_MASK,
DECORATION_MASK=DECORATION_MASK,
COLOR_NOT_SET=COLOR_NOT_SET,
COLOR_IS_SPECIAL=COLOR_IS_SPECIAL,
COLOR_IS_INDEX=COLOR_IS_INDEX,
COLOR_IS_RGB=COLOR_IS_RGB,
)
def resolve_cell_defines(only_fg: int, only_bg: int, src: str) -> str: