# Developing a theme plugin

**URL:** <https://community.jenkins.io/t/developing-a-theme-plugin/710>\
**Category:** Code\
**Tags:** question\
**Created:** [November 1, 2021, 8:39pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710 "2021-11-01T20:39:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 1, 2021, 8:39pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/1 "2021-11-01T20:39:27Z")

</div>

I’m in the process of writing a theme plugin. I read the pages [Plugin Tutorial](https://www.jenkins.io/doc/developer/tutorial/) ff. and the (rather short) [How to create a theme](https://github.com/jenkinsci/theme-manager-plugin/blob/ba144ba4d1f4d7b47bc5f0af29c93221649feed6/docs/developer-guide.md).

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…?

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [November 1, 2021, 9:23pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/2 "2021-11-01T21:23:46Z")

</div>

> [@geri](#):
>
> 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.

> [@geri](#):
>
> The build succeeds

mvn hpi:run?

> [@geri](#):
>
> Since I didn’t change the CSS I expected to see Jenkins with the dark theme, but no.

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

---

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 1, 2021, 9:52pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/3 "2021-11-01T21:52:13Z")

</div>

`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.

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [November 1, 2021, 10:03pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/4 "2021-11-01T22:03:11Z")

</div>

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

or link to your repo

---

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 1, 2021, 10:09pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/5 "2021-11-01T22:09:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [November 1, 2021, 10:19pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/6 "2021-11-01T22:19:45Z")

</div>

> [@geri](#):
>
> What about Q3 & Q4?

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

> [@geri](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![timja](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/timja/32/7_2.png) [@timja](https://community.jenkins.io/u/timja)\
**Post date:** [November 2, 2021, 7:51am UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/7 "2021-11-02T07:51:48Z")

</div>

Hopefully the last commit on [theme-manager-plugin/developer-guide.md at 8a9d7e81179dddbe6b5386429f00113a7d0b8ffb · jenkinsci/theme-manager-plugin · GitHub](https://github.com/jenkinsci/theme-manager-plugin/blob/8a9d7e81179dddbe6b5386429f00113a7d0b8ffb/docs/developer-guide.md) addresses Q4 for you.

Q3: As far as I know only the docs in theme manager and this page: [Themes for user interface](https://www.jenkins.io/doc/book/managing/ui-themes/#themes-support-policy)

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](https://github.com/jenkins-infra/jenkins.io/issues/4678) for improving the [jenkins.io](http://jenkins.io) page (I don’t have time for that right now)

What docs would be helpful?

---

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 2, 2021, 11:57am UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/8 "2021-11-02T11:57:58Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![uhafner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uhafner/32/68_2.png) [@uhafner](https://community.jenkins.io/u/uhafner)\
**Post date:** [November 2, 2021, 12:10pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/9 "2021-11-02T12:10:12Z")

</div>

There is already a theme that changes the weather icons, see [JENKINS-65124](https://issues.jenkins.io/browse/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.

---

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 2, 2021, 1:49pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/10 "2021-11-02T13:49:32Z")

</div>

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?](https://devops.stackexchange.com/questions/14909/how-to-get-the-classic-jenkins-build-status-icons-back).

---

<div class="post-metadata">

**Author:** ![uhafner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uhafner/32/68_2.png) [@uhafner](https://community.jenkins.io/u/uhafner)\
**Post date:** [November 2, 2021, 1:56pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/11 "2021-11-02T13:56:24Z")

</div>

> 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

```auto
java -jar jenkins.war --httpPort=8088

```

---

<div class="post-metadata">

**Author:** ![geri](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/geri/32/6934_2.png) [@geri](https://community.jenkins.io/u/geri)\
**Post date:** [November 2, 2021, 2:05pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/12 "2021-11-02T14:05:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![uhafner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uhafner/32/68_2.png) [@uhafner](https://community.jenkins.io/u/uhafner)\
**Post date:** [November 2, 2021, 3:20pm UTC](https://community.jenkins.io/t/developing-a-theme-plugin/710/13 "2021-11-02T15:20:41Z")

</div>

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

[https://jenkinsci.github.io/maven-hpi-plugin/run-mojo.html](https://jenkinsci.github.io/maven-hpi-plugin/run-mojo.html)
