Refactored the Preferences color-page edit-source model to use an explicit snapshot pointer (setup_color_edit_source_colors) and a helper that selects light vs dark snapshot palettes, so the page preview is decoupled from the runtime colors[] palette. This affects selector refresh, page initialization, and cleanup lifecycle.

Updated edit-target and dark-mode combo callbacks on the color page to stop applying global palette mode directly; they now only switch/refresh the Preferences page source palette.
Changed color-chooser behavior so setup_color_response_cb() writes edits to the selected target snapshot via palette_user_set_color / palette_dark_set_color, then refreshes only page widgets (no runtime palette apply). Also updated dialog initialization to read from the current edit-source snapshot.
Added palette snapshot accessors (palette_user_colors, palette_dark_colors) in the palette API and implementation so Preferences can render from light/dark snapshots safely without mutating runtime palette state.
Runtime palette changes remain on the real apply paths (theme/dark-mode application), not edit-target toggles.
This commit is contained in:
2026-02-25 22:48:55 -07:00
parent 685989fa25
commit c37faa1492
3 changed files with 59 additions and 17 deletions

View File

@@ -224,6 +224,27 @@ palette_dark_set_color (int idx, const PaletteColor *col)
dark_user_colors[idx] = *col;
}
const PaletteColor *
palette_user_colors (void)
{
if (!user_colors_valid)
{
memcpy (user_colors, colors, sizeof (user_colors));
user_colors_valid = TRUE;
}
return user_colors;
}
const PaletteColor *
palette_dark_colors (void)
{
if (!dark_user_colors_valid)
return dark_colors;
return dark_user_colors;
}
void
palette_alloc (GtkWidget * widget)
{