How to get Look and Feel Primary Color

Jackson Farnsworth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2018

I've found in the JIRA API Docs the class LookAndFeelBean, but I can't find a way to get the primary custom color of the JIRA instance using that. Is there a way to get the color, in any form, using Groovy/Java? 

1 answer

1 accepted

2 votes
Answer accepted
Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

What are you considering the primary custom color? The top menu's background color?

Jackson Farnsworth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

Any of the colors listed on the Look and Feel page on JIRA, but primarily I want to get the color of the "Header Background Color"

Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

Try

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.LookAndFeelBean

def applicationProperties = ComponentAccessor.getApplicationProperties()
def LookAndFeelBean lf = LookAndFeelBean.getInstance(applicationProperties)

return lf.getTopBackgroundColour() 
Jackson Farnsworth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

Exactly what I needed, thanks!

Suggest an answer

Log in or Sign up to answer