user2538755 user2538755 - 4 months ago 10
CSS Question

Retrieve Hex color from database to use as site's primary color

I have a form where a user can select a color from a color picker and it is then saved to the database. My objective is to be able to pull back that color from the database and use it as the site's primary color(like a theme), eg: navbar header and button colors. The user will also have the option to select a secondary color, but for now just the primary color will be attempted.

Normally I would have posted a snippet of an attempt(s), however, I am not sure where to begin as it relates to this problem. I am using Laravel and Angularjs as my frameworks.

Any help would be greatly appreciated in guiding me on the necessary steps I would need to take in order to accomplish my goal. Thanks In Advance.


How about storing the selected color and adding a class to the body like so:

<body class="{{ $color }}">

Then you can style the site using that class as a "hook" like this: { ... } { ... } { ... }