Load and query color schemes (themes) for syntax highlighting.
More...
Load and query color schemes (themes) for syntax highlighting.
Theme parsing and scope-to-color mapping.
Themes map scope hierarchies to foreground/background colors and font styles.
◆ TEXTMATE_FONT_STYLE_NONE
| #define TEXTMATE_FONT_STYLE_NONE 0 |
◆ textmate_theme_dispose()
Free a theme object and release resources.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*), or NULL (no-op) |
- Warning
- Do not use theme after calling this function
- Note
- Safe to call with NULL
Definition at line 437 of file c_api.cpp.
◆ textmate_theme_get_background()
| TML_API uint32_t textmate_theme_get_background |
( |
TextMateTheme |
theme, |
|
|
const char * |
scopePath, |
|
|
uint32_t |
defaultColor |
|
) |
| |
Get the background color for a scope path.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*) |
| scopePath | Scope path to match |
| defaultColor | Color to return if scope is not found in theme |
- Returns
- RGBA color value (0xRRGGBBAA format)
- See also
- textmate_theme_get_foreground()
Definition at line 278 of file c_api.cpp.
◆ textmate_theme_get_default_background()
| TML_API uint32_t textmate_theme_get_default_background |
( |
TextMateTheme |
theme | ) |
|
Get the default/fallback background color for the entire theme.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*) |
- Returns
- RGBA color value (0xRRGGBBAA format)
- Note
- Used when no matching scope is found in the theme
Definition at line 416 of file c_api.cpp.
◆ textmate_theme_get_default_foreground()
| TML_API uint32_t textmate_theme_get_default_foreground |
( |
TextMateTheme |
theme | ) |
|
Get the default/fallback foreground color for the entire theme.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*) |
- Returns
- RGBA color value (0xRRGGBBAA format)
- Note
- Used when no matching scope is found in the theme
Definition at line 395 of file c_api.cpp.
◆ textmate_theme_get_font_style()
| TML_API int32_t textmate_theme_get_font_style |
( |
TextMateTheme |
theme, |
|
|
const char * |
scopePath, |
|
|
int32_t |
defaultStyle |
|
) |
| |
Get the font style flags for a scope path.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*) |
| scopePath | Scope path to match |
| defaultStyle | Font style flags to return if scope is not found |
- Returns
- Combination of TEXTMATE_FONT_STYLE_* flags
- Note
- Flags can be combined with bitwise OR (e.g., BOLD | ITALIC)
- See also
- textmate_theme_get_foreground()
Definition at line 341 of file c_api.cpp.
◆ textmate_theme_get_foreground()
| TML_API uint32_t textmate_theme_get_foreground |
( |
TextMateTheme |
theme, |
|
|
const char * |
scopePath, |
|
|
uint32_t |
defaultColor |
|
) |
| |
Get the foreground color for a scope path.
- Parameters
-
| theme | Valid theme handle (from textmate_theme_load_*) |
| scopePath | Scope path to match (e.g., "source.js keyword.control", "string.quoted.double") |
| defaultColor | Color to return if scope is not found in theme |
- Returns
- RGBA color value (0xRRGGBBAA format, e.g., 0xFF0000FF for opaque red)
- Note
- Scope matching uses TextMate's scope selector rules
- See also
- textmate_theme_get_background(), textmate_theme_get_font_style()
Definition at line 215 of file c_api.cpp.
◆ textmate_theme_load_from_file()
| TML_API TextMateTheme textmate_theme_load_from_file |
( |
const char * |
themePath | ) |
|
Load a theme from a JSON file.
- Parameters
-
| themePath | Path to the theme JSON file (TextMate theme format) |
- Returns
- Opaque theme handle on success, NULL on error (file not found, invalid JSON, etc.)
- Note
- The returned theme must be disposed with textmate_theme_dispose()
Definition at line 162 of file c_api.cpp.
◆ textmate_theme_load_from_json()
| TML_API TextMateTheme textmate_theme_load_from_json |
( |
const char * |
jsonContent | ) |
|
Load a theme from a JSON string.
- Parameters
-
| jsonContent | Theme JSON content as a null-terminated string |
- Returns
- Opaque theme handle on success, NULL on error (invalid JSON)
- Note
- The returned theme must be disposed with textmate_theme_dispose()
Definition at line 191 of file c_api.cpp.