manton
manton

Micro.blog plug-ins can have a settings screen to change config parameters. I’ve added a new field type “color” that I’m hoping will be useful to customize the design of more themes. Modern web browsers provide a color picker for these. (Example config for this screenshot.)

Color config screenshot
|
Embed
Progress spinner
skoobz
skoobz

@manton I was just thinking about editing some color schemes. Thank you for this.

|
Embed
Progress spinner
In reply to
ericgregorich
ericgregorich

@manton is there an example of how to use these parameters in a custom theme/plugin? I see how to use Site.Params, im just not sure how to update my CSS. Maybe a custom style block on one of the templates?

|
Embed
Progress spinner
manton
manton

@ericgregorich We should write a tutorial for this... Because the CSS files aren't usually dynamic, a custom style block in a template is actually a good way to go. I did this in the Alpine theme. You can see it in alpine.html (which is included as a partial from head.html). There may be better ways, but it works!

|
Embed
Progress spinner
sod
sod

@ericgregorich Just like @manton, I've used custom style blocks in some of my plug-ins. It's fast and easy, but if you have a lot of CSS, you might want to break it out to separate files. Hugo has a robust assets pipeline, so you can: have dynamic (template-based) CSS files, bundle multiple CSS files into one, process SASS and SCSS, run minification, and more.

There's a minimal example on the page Creating a resource from a template.

|
Embed
Progress spinner
ericgregorich
ericgregorich

@sod @manton Thanks! I’ll probably work on that this week and I’ll share my notes for others.

|
Embed
Progress spinner
manton
manton

@ericgregorich @sod Excellent, that would be great for everyone to learn from it!

|
Embed
Progress spinner
Miraz
Miraz

@ericgregorich @sod @manton Would you also consider writing it up on @custom ? See: How to help : custom.micro.blog/how-to-he...

|
Embed
Progress spinner
ericgregorich
ericgregorich

@Miraz Absolutely.

|
Embed
Progress spinner
Miraz
Miraz

@ericgregorich 👍

|
Embed
Progress spinner