static gboolean palette_is_builtin (const GdkRGBA *colors, gsize n_colors, guint *n) { guint i; if (n_colors != TERMINAL_PALETTE_SIZE) return FALSE; for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS; ++i) { if (palette_cmp (colors, terminal_palettes[i])) { *n = i; return TRUE; } } return FALSE; }
gboolean terminal_profile_get_palette_is_builtin (TerminalProfile *profile, guint *n) { GdkColor colors[TERMINAL_PALETTE_SIZE]; guint n_colors; guint i; n_colors = G_N_ELEMENTS (colors); if (!terminal_profile_get_palette (profile, colors, &n_colors) || n_colors != TERMINAL_PALETTE_SIZE) return FALSE; for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS; ++i) if (palette_cmp (colors, terminal_palettes[i])) { *n = i; return TRUE; } return FALSE; }