terminal: unify palette functionality into shared type DynamicPalette

This commit is contained in:
Mitchell Hashimoto
2025-10-30 08:56:07 -07:00
parent c7d5d1b9fc
commit cabca0aca8
9 changed files with 288 additions and 98 deletions

View File

@@ -130,7 +130,7 @@ pub const Cell = struct {
switch (self.style.fg_color) {
.none => cimgui.c.igText("default"),
.palette => |idx| {
const rgb = t.color_palette.colors[idx];
const rgb = t.colors.palette.current[idx];
cimgui.c.igValue_Int("Palette", idx);
var color: [3]f32 = .{
@as(f32, @floatFromInt(rgb.r)) / 255,
@@ -169,7 +169,7 @@ pub const Cell = struct {
switch (self.style.bg_color) {
.none => cimgui.c.igText("default"),
.palette => |idx| {
const rgb = t.color_palette.colors[idx];
const rgb = t.colors.palette.current[idx];
cimgui.c.igValue_Int("Palette", idx);
var color: [3]f32 = .{
@as(f32, @floatFromInt(rgb.r)) / 255,

View File

@@ -51,7 +51,7 @@ pub fn renderInTable(
switch (cursor.style.fg_color) {
.none => cimgui.c.igText("default"),
.palette => |idx| {
const rgb = t.color_palette.colors[idx];
const rgb = t.colors.palette.current[idx];
cimgui.c.igValue_Int("Palette", idx);
var color: [3]f32 = .{
@as(f32, @floatFromInt(rgb.r)) / 255,
@@ -90,7 +90,7 @@ pub fn renderInTable(
switch (cursor.style.bg_color) {
.none => cimgui.c.igText("default"),
.palette => |idx| {
const rgb = t.color_palette.colors[idx];
const rgb = t.colors.palette.current[idx];
cimgui.c.igValue_Int("Palette", idx);
var color: [3]f32 = .{
@as(f32, @floatFromInt(rgb.r)) / 255,