Search code examples
javauser-interfacevaadinvaadin7

How to get current Vaadin Theme name?


I am using the @Theme annotation in Vaadin to set UI themes. How can I get this theme name in any view? Is there some sort of getTheme() method I can use?

Any help is appreciated.


Solution

  • As per the Vaadin API and in most cases: UI.getCurrent().getTheme(). Otherwise, eg: you're executing some background thread, you need to find a way to get hold of your UI instance.