mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-05-05 15:33:00 +00:00
Add config color palette C bindings
C bindings to expose the color palette to Swift for macOS.
This commit is contained in:
parent
4e91d11a60
commit
77f5fc34f1
@ -357,6 +357,11 @@ typedef struct {
|
||||
size_t len;
|
||||
} ghostty_config_color_list_s;
|
||||
|
||||
// config.Palette
|
||||
typedef struct {
|
||||
ghostty_config_color_s colors[256];
|
||||
} ghostty_config_palette_s;
|
||||
|
||||
// apprt.Target.Key
|
||||
typedef enum {
|
||||
GHOSTTY_TARGET_APP,
|
||||
|
@ -3930,6 +3930,24 @@ pub const Palette = struct {
|
||||
/// The actual value that is updated as we parse.
|
||||
value: terminal.color.Palette = terminal.color.default,
|
||||
|
||||
/// ghostty_config_palette_s
|
||||
pub const C = extern struct {
|
||||
colors: [265]Color.C,
|
||||
};
|
||||
|
||||
pub fn cval(self: Self) Palette.C {
|
||||
var result: Palette.C = undefined;
|
||||
for (self.value, 0..) |color, i| {
|
||||
result.colors[i] = Color.C{
|
||||
.r = color.r,
|
||||
.g = color.g,
|
||||
.b = color.b,
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn parseCLI(
|
||||
self: *Self,
|
||||
input: ?[]const u8,
|
||||
|
Loading…
x
Reference in New Issue
Block a user