Preview image for own themes

Hi all,

first of all, I would like to point out that my question is about a totally unimportant thing, but I wanted to ask it anyway :wink::

Where/how do I set a preview image for own themes. It looks a bit naked in the admin area without a proper preview image:

My inner Adrian Monk makes himself known here every time. And I know everyone has an inner Adrian Monk, and some are like mine. :face_with_tongue: So it might matter at least a little bit to other people as well.

Please forgive me if this was already answered here on Meta. But I did not find anything suitable through the search.

I remember this guide, but I don’t know if that’s what you are looking for:

1 Like

Thank you, but not really. Or I do not understand - which is always a possibility. :wink:

I created the theme in the screenshot of the standard theme from my self-hosted Discourse instance. So I did not download or upload it anywhere. Also I do not see a theme directory in the shared file paths outside the Docker container.

So I am still a little lost here… :man_shrugging:

I believe the screenshots are only for themes you create yourself from Github, like developing it yourself. Hence it’s in Documentation > Developer Guides.

Yeah. So the question remains. Is there any way?

And again, not the most important question and feature of all. :wink:

If you created the theme purely via the admin user interface, no.

In order to have screenshots you should have a local file/directory structure that mirrors the theme.
You could export the theme, unzip it, add the screenshots as in the guide mentioned above, re-zip it and import it. But then again, screenshots are used mostly to show other people what your theme looks like, so if you didn’t upload it anywhere, who would that be ?

Okay. Thank you. Then it is as it is. :slight_smile:

Other admins for example. But as I said, it is not really important. I just notice it every time I am there to edit something in the theme.

It’s maybe a little hacky, but you can replace the default SVG pattern with a custom image with the help of CSS.
Example result

In the uploads section of your theme, you add the screenshot

and in the CSS tab of ā€œedit codeā€ you add

lowercase & replace spaces with hyphens

.theme-card.=THEME_NAME= .theme-card__image-wrapper svg {
 display: none;
}

.theme-card.=THEME_NAME= .theme-card__image-wrapper {
 background-image: url($=UPLOAD_NAME=);
 background-size: cover;
 background-position: center;
}

I hope this is enough to bring a little more relaxation to your inner Monk.

5 Likes

Wow thank you very much for that. It worked right you described it. And it was just copy-paste thanks to your post. Cool! :+1:

My inner Monk seems not to be there anymore. At least when it comes to this. :stuck_out_tongue:

2 Likes