this post was submitted on 11 Jun 2023
5 points (100.0% liked)

Lemmy Support

4651 readers
1 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I'm trying to add a modified css for lemmy-ui to my self-hosted instance running on Docker. I'm following this guide but the custom theme is just showing up as litely. Steps taken:

  • Went to bootstrap.build, made the necessary edits.
  • Exported the bootstrap.min.css as well as the _variables.scss
  • Renamed them to theme-name.css and _variables.theme-name.scss
  • Do the necessary bind mounts so lemmy-ui can access the files. Can confirm the files are correct and appear within the container.
  • From lemmy web ui, select from drop down the theme called theme-name (it shows up with the right name and all).
  • Press Save, but theme is just litely.
  • Use dev tools on browser and can confirm theme-name.css is just the litely css. cat theme-name.css within the container is showing the right content.
  • LEMMY_UI_EXTRA_THEMES_FOLDER is set correctly since the option for theme-name is showing up, it's just loading litely instead.

Not sure what I'm doing wrong here :/

top 12 comments
sorted by: hot top controversial new old
[–] justin@lemmy.justin.rs 2 points 1 year ago
[–] AcornCarnage@lemmy.world 2 points 1 year ago (1 children)

Were you able to figure this out? Because honestly, this post is already 10x more helpful than the theming page in the Lemmy docs.

[–] lckdscl@whiskers.bim.boats 2 points 1 year ago (1 children)

Yeah I figured it out (check out my instance), a few hiccups here and there but I basically did the same thing I posted up there and it now loads correctly.

The problem wasn't from my end, lemmy-ui didn't move fully to bootstrap 5 when I made that post.

After an update to pre version 0.18.x, I could use bootstrap.build and follow the rest and the theme loads.

Post 0.18.x, when the devs reintroduced some bundled themes like the vaporwave ones and others, my theme broke again, bootstrap.build doesn't seem to work anymore. They now also require three files _variables.theme.css, theme.scss and theme.css

Now I'm not a web frontend dev or anything like that so I ended up just copy and renamed the vaporwave theme and edited it to what I want.

[–] AcornCarnage@lemmy.world 2 points 1 year ago

Thank you SO much. There were a lot of blanks to fill in with the doc page. I was putting the theme files in subfolders rather than renaming (though I suspected that was my issue). Then it says to use v4 themes, and those KIND of worked, but kind of not. v5 seems good so far. Still a bit more to figure out, but you've been incredibly helpful!

[–] tko@tkohhh.social 1 points 1 year ago (1 children)

Do you have any idea how to uninstall a theme? I installed one css file incorrectly, and then later deleted it. It's still showing up in my theme list though. Any ideas?

[–] lckdscl@whiskers.bim.boats 2 points 1 year ago (1 children)

Maybe it's cached... have you tried in incognito or force reload? If not, maybe try manually deleting the nginx cache if you set up Lemmy with nginx.

[–] tko@tkohhh.social 1 points 1 year ago

I think you're right, as the entry is gone as of this morning. I was force refreshing, and I even restarted the docker-compose stack (thinking that would clear anything), but it still persisted. I'll have to look into the nginx cache. Thanks for chiming in!

[–] tko@tkohhh.social 1 points 1 year ago (1 children)

Sorry to keep coming back to this thread, but so far this is the only place I've found discussing themes in a remotely helpful way.

What are you using to generate the CSS file from the two SCSS files?

I copied the lightly theme and updated/added a couple of variables. I then used bootstrap.build to generate the CSS file, but it breaks the layout (see screenshot). Is there some other way to generate the CSS? Surely you aren't editing it by hand, are you?

[–] lckdscl@whiskers.bim.boats 0 points 1 year ago (1 children)

If you see my response to the other comment on this post, I basically had the same issue, my theme looked like the screenshot you attached when generating with bootstrap.build. I ended up not using it at all.

I didn't want to get into bootstrap, so yes I edited it by hand. My theme isn't perfect yet, it took me 2 hours or so by editing the vaporwave theme.

[–] tko@tkohhh.social 0 points 1 year ago (1 children)

OK, thanks for the input. My theory at the moment is that Lemmy doesn't actually need the SCSS files. If you look at the CSS file, it doesn't reference the variables at all. That's why you've had success modifying the CSS by hand. Somebody in the Matrix chat said that they pulled down the lemmy-ui code so that they could generate the CSS file in the same way that the built-in themes do. I'm going to take a look at that now and see if there's a way to extract that portion.

[–] lckdscl@whiskers.bim.boats 0 points 1 year ago (1 children)

Ah that would make sense as to why the SCSS files don't do anything.

[–] tko@tkohhh.social 1 points 1 year ago

I think I have this figured out. See my post here: https://tkohhh.social/post/4829