Django modify css/sass with database values

I'm making a website where I want to be able to do many color and css customizations gotten from a Theme model. Right now the only way I can think of applying the colors is like the code below but it doesn't take much to see why this is bad practice.

class Theme(models.Model):
    url_color =  models.CharField(max_length=64)

<a href style="color: {{ context_processor.url_color }}">

I am also using sass to generate the css file and it would be helpful if the answer could make the color values from the database work with sass's lighten and darken.

Upvotes: 3

Views: 303

Answers (1)

Sanu
Sanu

Reputation: 33

You could explore https://www.grooveui.com They claim to allow creation of multiple website themes from SASS files.

I believe they are doing the logic of storing variables in database and creating independent SASS files for each theme.

I am using there service in one of my personal projects and it seems to work fine.

Upvotes: 1

Related Questions