You have some colors, you need to construct one-(two-)dimensional gradient using only these colors.