Gitea: Custom themes not working

So I got the container Gitea running and it works, mounted this way:

volumes:
  - /home/user/docker-data/gitea:/data

According to gitea docs:

Add a CSS file to $GITEA_PUBLIC/public/css/theme-<theme-name>.css. The value of $GITEA_PUBLIC of your instance can be queried by calling gitea help and looking up the value of “CustomPath”.

Add <theme-name> to the comma-separated list of setting THEMES in app.ini

Calling the cli and gitea help gives me: CustomPath: /data/gitea (GITEA_CUSTOM)

So if /home/user/docker-data/gitea:/data then /data/gitea/home/user/docker-data/gitea/gitea which follows that

$GITEA_PUBLIC/public/css//home/user/docker-data/gitea/gitea/public/css.

Which I have, and where I put the files in: https://i.imgur.com/GSdYNAr.png . app.ini has

[ui]
DEFAULT_THEME                     = gitea
THEMES                            = gitea,arc-green,gitea-modern,plex

and I have it to choose from in gitea: https://i.imgur.com/a9BoWI4.png

Only problem is: They do nothing.

On a side note: The path has changed in Gitea 1.15, there the file needs to be placed in $GITEA_CUSTOM/public/assets/css I have public/css and public/assets/css. Both not working.

It is not just you. I have gitea installed directly to an ubuntu server, no docker, and the themes do not even show up in the list. I also tried both locations.

@jieiku did you figure it out? If not it may help to get more details on how you followed the documentation. What is your custom directory? A ls -l of the theme you try to install as well as the modification you made to the configuration file. Maybe there is subtle typo somewhere :slight_smile:

I’m running it in a docker container, entering the terminal via portainer and ls -l gives me this:

And do you see your theme in the public directory?

d10ccffc7763:~$ gitea --version
Gitea version 1.16.5 built with GNU Make 4.3, go1.18 : bindata, timetzdata, sqlite, sqlite_unlock_notify
d10ccffc7763:~$ gitea help | grep CustomPath
     CustomPath:  /data/gitea (GITEA_CUSTOM)
d10ccffc7763:~$ find /data/gitea/public

I did get this working. I think the problem some people face is that gitea custom folder is not where they think, depending on their install method.

For some this may be because of the confusion with /assets. which is simply a POINTER to $GITEA_CUSTOM/public however some people believe it means to do this $GITEA_CUSTOM/public/assets/css I seen a few posts like this. (including this very thread)

So for me my directory structure is:

/var/lib/gitea/custom/public/css/theme-dark-arc.css

but if you view the page source in a web browser you will see:

/assets/css/index.css?v=1b37ebcaa3151193e91d19ed55808a12

but they are one and the same file.

This is how I did it when running in a Proxmox LXC ubuntu container, running as a service. When running Gitea in a docker container I am not sure what you need to do in order to specify --custom-path and --config as I do on the ExecStart line of my gitea.service file

This is the theme I created: GitHub - Jieiku/theme-dark-arc-gitea: Dark theme with high contrast for Gitea, based on arc-green.

Fix custom path, edit the service file and set the config and custom-path values yourself:

sudo nano /etc/systemd/system/gitea.service

ExecStart=/usr/local/bin/gitea web --custom-path /var/lib/gitea/custom --config /var/lib/gitea/custom/conf/app.ini

Then edit the app.ini config file:

sudo nano /var/lib/gitea/custom/conf/app.ini

[ui]
DEFAULT_THEME = dark-arc
THEMES = gitea,dark-arc

Create the theme file:

sudo mkdir -p /var/lib/gitea/custom/public/css
cd /var/lib/gitea/custom/public/css
wget https://raw.githubusercontent.com/Jieiku/theme-dark-arc-gitea/main/theme-dark-arc.css

Make sure ownership is correct:

sudo chown -R git:git /var/lib/gitea

Restart gitea service

sudo systemctl restart gitea

The theme may automatically be active now, but if not click your avatar in top right, click settings, click appearance tab, select the theme and click update theme button.

2 Likes

also @dachary

I specified my custompath manually in my gitea service file (/var/lib/gitea/custom)

however when I issue:

gitea help | grep CustomPath

it incorrectly reports:

CustomPath: /usr/local/bin/custom

So I am not sure how accurate the gitea help screen is at reporting the correct CustomPath

find /usr/local/bin/custom
find: ‘/usr/local/bin/custom’: No such file or directory

I think if the running instance of gitea showed the CustomPath that would be a better way to correctly identify the path, so maybe in the gitea settings menu when you have it in a web page or something.

EDIT: THERE IS! click your avatar in top right corner, click site administration, click configuration tab.

1 Like

@jieiku this is a very useful and detailed explanation that I will keep in my bookmarks :+1: And I will make a note to not recommend gitea help to figure out the CustomPath.

1 Like

Another thing I noticed is that page also shows what user the gitea service runs as. So in my case it runs as user git, which is why I set ownership of my files to user git, but if for some reason docker or other environments ran as a different user then you would want to set file ownership appropriately.

1 Like

I went ahead and included that information in the readme of my theme: GitHub - Jieiku/theme-dark-arc-gitea: Dark theme with high contrast for Gitea, based on arc-green.

1 Like

Fuck me, forget I ever asked this questions. It is what it is in a docker container. Not pretty, but works and get’s the job done.

Thanks for the update @NoCanDo.

I’d like to express that the strong language of the previous message makes me uncomfortable. If the first two words were omitted, I would feel better.

Yeah, I don’t get why British people say ‘Fuck me’ as in ‘I’ll be damned’. To Americans it sounds sounds way more explicit than intended.

Greats, it works for me.