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?

Cheers,
Kevin

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

    Kevin Stembridge's Avatar

    Hi Sean,

    Any thoughts on this one?

    Cheers,
    Kevin

  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 com.moneydance.apps.md.view.gui.MDColors.getSingleton() 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.

    Thanks!

    Sean Reilly
    Developer, The Infinite Kind
    http://infinitekind.com

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

    Kevin Stembridge's Avatar

    Great stuff, Sean.

    Thanks for the info.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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