Add palette abstrction to abvoid duplication and make color grouping easy