Liferay: Get a list of Colour schemes for a theme in Portlet

Just trying to work out how to set theme colour schemes in a portlet, and I’m no step closer, but I did find out how to get a list of colour schemes in a portlet, and it goes a bit like this:

ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
List<ColorScheme> colors = themeDisplay.getTheme().getColorSchemes();
for(ColorScheme color : colors) {
System.out.println(“color: “+color.getName()+ “(“+color.getColorSchemeId()+”)”);

I know, I know, there’s a system.out in the code, it’s only for people to see, I would never do that in a production portlet ;-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>