Logic behind changing styles in a cms

Okay I’m going to be starting a project making a cms for a very specific market. I want this cms to be as customizable as possible of course. One thing I definitely want it to be able to do is change the style sheet info from the admin panel. Can anyone explain to me the way this is accomplished. I would like something like the way vbulletin does their style options, not the template system but being able to change font colors and certain images.

So far im thinking there is a file or database table that you update with new style info. You could include that file in the page and put the specific css info in with php from the included file. Or you could get the info from a database query. Is this the best way to go?

I also need to make one of those color picker javascript things. Are there any opensource ones out there?

Thanks for the help:P