3

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.

2
  • I think a template tag would be the way to go here Commented Jun 24, 2017 at 6:40
  • can you please specify why a template tag would not be the best way to do it? Commented Jun 24, 2017 at 18:43

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.