I am developing a WordPress theme. I have seen that many theme give option to users to select the theme color.
How do they do that? They are doing it via filter? Which methods they use to give option to give users to select the theme color?
They’re using the Theme Customization API. It has a built-in color picker feature. Feel free to check out the code they’re using and try it for yourself.
Here’s a YouTube video that might help: https://www.youtube.com/watch?v=dwxIdLSK22o
Instead of a series of color pickers, you might want to consider using radio buttons to select predefined color schemes. That way, the user doesn’t have the option to make the theme look bad.
Check out the Twenty Fifteen theme for an example: https://github.com/WordPress/WordPress/tree/master/wp-content/themes/twentyfifteen