In my theme Hallo I offer configuration options for the colors of the site, so that the user can set colors using config.toml. I use the following code to get the colors into SCSS:
This does not work with Hugo Basic whenever the user sets custom colors. This makes sense: the SCSS needs to be transpiled to CSS again because of the changed colors, which Hugo Basic cannot do.
A possible solution I see is to use CSS variables in a separate CSS file. A disadvantage of this is that two CSS files need to be loaded: one where the variables are defined, and another one for the transpiled SCSS. It also makes my theme unusable for people who want to support older browsers.
Thanks a lot for your suggestions! I’m afraid I’ll have to go back to plain old CSS, since I don’t want to restrict the users in which colors they choose, and would like them to be able to support older browsers if they want to.
It’s a pity there are some rough edges around Hugo Pipes, SCSS transpiling and the distinction between Hugo Basic and Extended. Don’t get me wrong, at the moment I also don’t have a solution, given that the distinction is here to stay. I’ll see if I can come up with ways to make maintaining themes, that use these functionalities, a bit easier.
A way around this would be for your users to install the Hugo Extended version locally, do their color changes, then commit their resources folder, which includes a cache of all the SCSS stuff.
That’s also a very good solution! I’m going to include this in the readme of the theme for now, so that the person who opened the issue can finish their site, while I think about whether I want to alter the theme for this single case.
This is one of the things I love about Hugo: there are usually multiple solutions to a problem!