Developing a theme plugin

I’m in the process of writing a theme plugin. I read the pages Plugin Tutorial ff. and the (rather short) How to create a theme.

I copied the *.java and *.css files from the [dark-theme-plugin](xttps://github.com/jenkinsci/dark-theme-plugin) into my project and adapted the *.java sources to my theme name. I left the *.css sources as they are. The build succeeds, the local Jetty starts in Eclipse/m2e and I can access the Jenkins instance in my browser. Since I didn’t change the CSS I expected to see Jenkins with the dark theme, but no.

Q1) What am I missing?
Q2) What to do next?
Q3) Is there any further dev documentation?
Q4) Where can I find a documentation for the theme.css to be able to create my own accordingly?

P.S.: “New users can only put 2 links in a post”? WT…?

its to prevent spam/bots for level 0, once you do a single action you become level 1 and most of the restrictions are done.

mvn hpi:run?

afaik dark theme isn’t global by default, you either have to force it in manage settings, or on your user settings page.

1 Like

mvn clean install and mvn hpi:run succeed. I meant the former.

There are just the themes:

  • Default
  • Tango
  • Tango (Respect OS/Browser system setting)

in Manage Jenkins of the Jetty test instance.

There is no user in the Jetty test instance.

i’m assuming tango isnt your new theme? You’ll have to wait for someone with more experience

or link to your repo

1 Like

My bad, it is. I was so annoyed by the msg “Our automated spam filter, Akismet, has temporarily hidden your topic.” that I didn’t remember that. Did you or can you promote me?

After changing to it Jenkins appears with the dark theme now. Thanks for the hint!

I don’t have a public remote repo for this yet. It’s just local for now.

What about Q3 & Q4?

I don’t know sorry, I havn’t done theme development, you’ll have to wait.

your topic got re-flagged, so i unflagged it.

Hopefully the last commit on theme-manager-plugin/developer-guide.md at 8a9d7e81179dddbe6b5386429f00113a7d0b8ffb · jenkinsci/theme-manager-plugin · GitHub addresses Q4 for you.

Q3: As far as I know only the docs in theme manager and this page: Themes for user interface

Which is dated as it doesn’t cover theme manager or the already implemented themes.
I’ve raised Themes for user interface page - Missing theme manager and implemented themes · Issue #4678 · jenkins-infra/jenkins.io · GitHub for improving the jenkins.io page (I don’t have time for that right now)

What docs would be helpful?

1 Like

The last commit doesn’t help me in my case (see below).

Thanks, I found further dev doc in the meantime.

I’d need infos about how to replace icons via a theme (I hate the new flat earthers edition so much that this is the igniting spark to write my first plugin after years of working with Jenkins and answering Jenkins-related questions on SO.). I thought this is done via CSS as well but I can’t find anything according in theme.less.

There is already a theme that changes the weather icons, see JENKINS-65124 for details.

Since there are so many watchers for that issue, I wonder why nobody of them creates a new PR to improve these icons in core.

1 Like

Thanks. That helped. Now there are further questions:

Q5) How to start the Jetty test instance with pre-defined config, like users, projects, plugins I’m relying on in my plugin, etc.?
Q6) How to change the HTTP port the test instance is runnig on.

And, it’s not just the color, contrast or shading, etc., it’s How to get the classic Jenkins build status icons back?.

Q5) How to start the Jetty test instance with pre-defined config, like users, projects, plugins I’m relying on in my plugin, etc.?

Is this JENKINS_HOME already on your machine? Then I would simply copy JENKINS_HOME locally and deploy your plugin to the copied instance (remove the old plugin from the plugin folder and replace it with the new version). It is possible to use mvn hpi:run as well (I don’t use it on my own).

Q6) How to change the HTTP port the test instance is runnig on.

This depends on how you start your Jenkins instance in general. I am using

java -jar jenkins.war --httpPort=8088

Q5) Which JENKINS_HOME?

I have one locally for testing general config, project’s config, answering SO questions, etc.

There is another one when developing that’s started with mvn hpi:run from within Eclipse (I don’t develop Java on the command line, of course.). I’m referring to this one which is rather “naked” by default.

Q6) See above…no cmd line

Then you need to provide some options for mvn hpi:run:

https://jenkinsci.github.io/maven-hpi-plugin/run-mojo.html

1 Like