DescribeColorResult Class
Namespace
Usage
The getColors method of the Schema.DescribeTabResult class returns a list of Schema.DescribeColorResult objects that describe colors used in a tab.
The methods in the Schema.DescribeColorResult class can be called using their property counterparts. For each method starting with get, you can omit the get prefix and the ending parentheses () to call the property counterpart. For example, colorResultObj.color is equivalent to colorResultObj.getColor().
Example
This sample shows how to get the color information in the Sales app for the first tab’s first color.
1// Get tab set describes for each app
2List<Schema.DescribeTabSetResult> tabSetDesc = Schema.DescribeTabs();
3
4// Iterate through each tab set describe for each app and display the info
5for(Schema.DescribeTabSetResult tsr : tabSetDesc) {
6 // Display tab info for the Sales app
7 if (tsr.getLabel() == 'Sales') {
8 // Get color information for the first tab
9 List<Schema.DescribeColorResult> colorDesc = tsr.getTabs()[0].getColors();
10 // Display the icon color, theme, and context of the first color returned
11 System.debug('Color: ' + colorDesc[0].getColor());
12 System.debug('Theme: ' + colorDesc[0].getTheme());
13 System.debug('Context: ' + colorDesc[0].getContext());
14 }
15}
16
17// Example debug statement output
18// DEBUG|Color: 1797C0
19// DEBUG|Theme: theme4
20// DEBUG|Context: primaryDescribeColorResult Methods
The following are methods for DescribeColorResult. All are instance methods.
getColor()
Returns the Web RGB color code, such as 00FF00.
Signature
public String getColor()
Return Value
Type: String
getContext()
Returns the color context. The context determines whether
the color is the main color for the tab or not.
Signature
public String getContext()
Return Value
Type: String
getTheme()
Returns the color theme.
Signature
public String getTheme()
Return Value
Type: String
Possible theme values include theme3, theme4, and custom.
- theme3 is the Salesforce theme introduced during Spring ‘10.
- theme4 is the Salesforce theme introduced in Winter ‘14 for the mobile touchscreen version of Salesforce.
- custom is the theme name associated with a custom icon.