bd44b5aa08
Test / build-libghostty-vt (x86_64-windows-gnu) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-ios) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt-macos (x86_64-macos) (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-dist (push) Has been cancelled
Test / GTK x11=true wayland=true (push) Has been cancelled
Test / Build -Dsimd=false (push) Has been cancelled
Test / Build -Dsimd=true (push) Has been cancelled
Test / Build -Dsentry=false (push) Has been cancelled
Test / Build -Dsentry=true (push) Has been cancelled
Test / zig-fmt (push) Has been cancelled
Test / GitHub Actions Pins (push) Has been cancelled
Test / prettier (push) Has been cancelled
Test / swiftlint (push) Has been cancelled
Test / alejandra (push) Has been cancelled
Test / typos (push) Has been cancelled
Nix / Required Checks: Nix (push) Has been cancelled
Nix / check-zig-cache-hash (push) Has been cancelled
Test / skip (push) Has been cancelled
Test / Required Checks: Test (push) Has been cancelled
Test / build-bench (push) Has been cancelled
Test / list-examples (push) Has been cancelled
Test / Example ${{ matrix.dir }} (Windows) (push) Has been cancelled
Test / build-cmake (push) Has been cancelled
Test / test-lib-vt-pkgconfig (push) Has been cancelled
Test / build-flatpak (push) Has been cancelled
Test / build-snap (push) Has been cancelled
Test / build-libghostty-vt (aarch64-linux) (push) Has been cancelled
Test / build-libghostty-vt (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt (wasm32-freestanding) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux-musl) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-macos) (push) Has been cancelled
Test / build-libghostty-vt-android (aarch64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-android (arm-linux-androideabi) (push) Has been cancelled
Test / build-libghostty-vt-android (x86_64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-windows (push) Has been cancelled
Test / build-libghostty-windows-gnu (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-linux-libghostty (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-dist-lib-vt (push) Has been cancelled
Test / trigger-snap (push) Has been cancelled
Test / trigger-flatpak (push) Has been cancelled
Test / build-macos (push) Has been cancelled
Test / build-macos-freetype (push) Has been cancelled
Test / test (push) Has been cancelled
Test / test-lib-vt (push) Has been cancelled
Test / GTK x11=false wayland=false (push) Has been cancelled
Test / GTK x11=true wayland=false (push) Has been cancelled
Test / GTK x11=false wayland=true (push) Has been cancelled
Test / test-macos (push) Has been cancelled
Test / test-windows (push) Has been cancelled
Test / Build -Di18n=false (push) Has been cancelled
Test / Build -Di18n=true (push) Has been cancelled
Test / Build test/fuzz-libghostty (push) Has been cancelled
Test / shellcheck (push) Has been cancelled
Test / translations (push) Has been cancelled
Test / blueprint-compiler (push) Has been cancelled
Test / Test pkg/wuffs (push) Has been cancelled
Test / Test build on Debian 13 (push) Has been cancelled
Test / valgrind (push) Has been cancelled
Test / Example ${{ matrix.dir }} (push) Has been cancelled
140 lines
2.9 KiB
C
140 lines
2.9 KiB
C
/**
|
|
* @file style.h
|
|
*
|
|
* Terminal cell style types.
|
|
*/
|
|
|
|
#ifndef GHOSTTY_VT_STYLE_H
|
|
#define GHOSTTY_VT_STYLE_H
|
|
|
|
#include <ghostty/vt/color.h>
|
|
#include <ghostty/vt/types.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** @defgroup style Style
|
|
*
|
|
* Terminal cell style attributes.
|
|
*
|
|
* A style describes the visual attributes of a terminal cell, including
|
|
* foreground, background, and underline colors, as well as flags for
|
|
* bold, italic, underline, and other text decorations.
|
|
*
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* Style identifier type.
|
|
*
|
|
* Used to look up the full style from a grid reference.
|
|
* Obtain this from a cell via GHOSTTY_CELL_DATA_STYLE_ID.
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
typedef uint16_t GhosttyStyleId;
|
|
|
|
/**
|
|
* Style color tags.
|
|
*
|
|
* These values identify the type of color in a style color.
|
|
* Use the tag to determine which field in the color value union to access.
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
typedef enum GHOSTTY_ENUM_TYPED {
|
|
GHOSTTY_STYLE_COLOR_NONE = 0,
|
|
GHOSTTY_STYLE_COLOR_PALETTE = 1,
|
|
GHOSTTY_STYLE_COLOR_RGB = 2,
|
|
GHOSTTY_STYLE_COLOR_TAG_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
|
|
} GhosttyStyleColorTag;
|
|
|
|
/**
|
|
* Style color value union.
|
|
*
|
|
* Use the tag to determine which field is active.
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
typedef union {
|
|
GhosttyColorPaletteIndex palette;
|
|
GhosttyColorRgb rgb;
|
|
uint64_t _padding;
|
|
} GhosttyStyleColorValue;
|
|
|
|
/**
|
|
* Style color (tagged union).
|
|
*
|
|
* A color used in a style attribute. Can be unset (none), a palette
|
|
* index, or a direct RGB value.
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
typedef struct {
|
|
GhosttyStyleColorTag tag;
|
|
GhosttyStyleColorValue value;
|
|
} GhosttyStyleColor;
|
|
|
|
/**
|
|
* Terminal cell style.
|
|
*
|
|
* Describes the complete visual style for a terminal cell, including
|
|
* foreground, background, and underline colors, as well as text
|
|
* decoration flags. The underline field uses the same values as
|
|
* GhosttySgrUnderline.
|
|
*
|
|
* This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
typedef struct {
|
|
size_t size;
|
|
GhosttyStyleColor fg_color;
|
|
GhosttyStyleColor bg_color;
|
|
GhosttyStyleColor underline_color;
|
|
bool bold;
|
|
bool italic;
|
|
bool faint;
|
|
bool blink;
|
|
bool inverse;
|
|
bool invisible;
|
|
bool strikethrough;
|
|
bool overline;
|
|
int underline; /**< One of GHOSTTY_SGR_UNDERLINE_* values */
|
|
} GhosttyStyle;
|
|
|
|
/**
|
|
* Get the default style.
|
|
*
|
|
* Initializes the style to the default values (no colors, no flags).
|
|
*
|
|
* @param style Pointer to the style to initialize
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
GHOSTTY_API void ghostty_style_default(GhosttyStyle* style);
|
|
|
|
/**
|
|
* Check if a style is the default style.
|
|
*
|
|
* Returns true if all colors are unset and all flags are off.
|
|
*
|
|
* @param style Pointer to the style to check
|
|
* @return true if the style is the default style
|
|
*
|
|
* @ingroup style
|
|
*/
|
|
GHOSTTY_API bool ghostty_style_is_default(const GhosttyStyle* style);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
#endif /* GHOSTTY_VT_STYLE_H */
|