How does an extension hook into the user-selected theme?

Kevin Stembridge's Avatar

Kevin Stembridge

27 Oct, 2017 04:14 PM

Hi folks,

The user can select a theme from File -> Preferences. How does an extension get hold of the selected theme and its settings?


  1. 1 Posted by Kevin Stembridg... on 08 Jan, 2018 09:21 PM

    Kevin Stembridge's Avatar

    Hi Sean,

    Any thoughts on this one?


  2. 2 Posted by Kevin Stembridg... on 01 Mar, 2018 01:08 AM

    Kevin Stembridge's Avatar

    Still wanting to be able to do this.

  3. Support Staff 3 Posted by Sean Reilly on 01 Mar, 2018 11:06 AM

    Sean Reilly's Avatar

    Hi Kevin,
    Sorry I let this drop. It's not technically an exposed API, but I think it is worth using it to improve the experience for the customer. Most of the colour changes are set as properties in the UIManager and so should be applied automatically to most UI elements. However, to get at the colours directly you can use which will return the MDColors instance used by the rest of the app. The colors are simple public member variables with the same text string shown in the theme customisation window, but you can also get them from your IDE with the MD2017 jar file loaded and auto-completion or decompilation.

    I would recommend putting some sort of reflection check for a member variable with the name of the colour you'd like to use, just in case we change or remove any of the colour names. We don't have plans to change or remove any, but it is possible.


    Sean Reilly
    Developer, The Infinite Kind

  4. 4 Posted by Kevin Stembridg... on 01 Mar, 2018 11:36 AM

    Kevin Stembridge's Avatar

    Great stuff, Sean.

    Thanks for the info.

  5. System closed this discussion on 31 May, 2018 11:40 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac