color palette popup code refactor