I am storing user color theme preference in the database (not a pre-defined list of colors). I want to dynamically change the site color scheme after the user save settings.
I want my application.css to take in dynamic variables if possible.
application.css (want to take in dynamic hex color):
primary: #0275d8;
secondary: #515257;
user_settings model
- user_id
- primary
- secondary
user_settings.html.erb
<%= form_for :settings do |f| %>
primary: <%= f.text_field :primary %><br />
secondary : <%= f.text_field :secondary %><br />
<%= f.submit %>
<% end %>
From other stack overflow posts, there are ways to change a particular reference of css by manipulating the DOM. However, bootstrap primary and secondary color are applying to a bunch of places so I am hoping there's a less redundant way to solve this problem. Thank you for your help in advanced.