0

I have a set of *.scss files that are compiled to my main.min.css file. There is variable with color (lets say $customColor) that is used in many very places. I have my users in database and one field is UserColor with hex rgb code.

Now after login user has to see website with color with $customColor setted as RGB. I don't know how do it in my asp.net application without change css in top of view.

There will be thousands of user so I cant have many of css for every user with one difference - the $customColor.

Is it possible to do in client side? It would help avoid conflicts on server when many of people will log to service. Then I would like to for example in all main.min.css file replace all places where is setted for example "#e45f2" to custom color. Then I would return color to view as ViewBag and use in Jquery function. Is it possible?

cadi2108
  • 1,280
  • 6
  • 19
  • 43
  • Also related: http://stackoverflow.com/questions/1409225/changing-a-css-rule-set-from-javascript and http://stackoverflow.com/questions/566203/changing-css-values-with-javascript – cimmanon Jun 01 '15 at 12:19

1 Answers1

0

The only way I can see to do this is give a class to the colored elements, and define that color via JS :

HTML

<span class='customColor'>Some text</span>

jQuery

$('.customColor').css('color', customColor);
Jeremy Thille
  • 26,047
  • 12
  • 43
  • 63
  • Unfortunally I can't modify html/css code, I have ready and one thing I can change is variable with color in sass file programically. – cadi2108 Jun 01 '15 at 12:13