Newer Version Available

This content describes an older version of this product. View Latest

describeTheme()

Returns information about themes available to the current logged-in user.

Syntax

1DescribeThemeResult = connection.describeTheme(string sObjectType[]);

Usage

Use describeTheme() to get current theme information for a given array of objects. Theme information consists of colors and icons for an object in Salesforce, used for a particular theme. For example, the Merchandise__c object might use the “computer32” icon and a primary tab color of red for the regular Salesforce application theme, and a different set of colors and icons for the mobile touchscreen version of Salesforce.

If you pass null instead of an array of objects, describeTheme() returns theme information for all objects in your organization that use theme colors and icons.

Your client application must be logged in with sufficient access rights to retrieve theme information about your organization’s data. For more information, see Factors that Affect Data Access.

describeTheme() is available in API version 29.0 and later.

Sample

This Java sample calls describeTheme() to retrieve theme information for Account and Contact, and then iterates over the retrieved theme information.

1swfobject.registerObject("clippy.codeblock-1", "9");public static void describeThemeExample() {
2    try {
3        // Get current themes
4        DescribeTheme themeResult = connection.describeTheme(
5                                        new String[] { "Account", "Contact" });
6        DescribeThemeItem[] themeItems = themeResult.getThemeItems();
7        for (int i = 0; i < themeItems.length; i++) {
8            DescribeThemeItem themeItem = themeItems[i];
9            System.out.println("Theme information for object " + themeItem.getName());
10            // Get color and icon info for each themeItem
11            DescribeColor colors[] = themeItem.getColors();
12            System.out.println("    Number of colors: " + colors.length);
13            int k;
14            for (k = 0; k < colors.length; k++) {
15                DescribeColor color = colors[k];
16                System.out.println("    For Color #" + k + ":");
17                System.out.println("      Web RGB Color: " + color.getColor());
18                System.out.println("      Context: " + color.getContext());
19                System.out.println("      Theme: " + color.getTheme());
20            }
21            DescribeIcon icons[] = themeItem.getIcons();
22            System.out.println("    Number of icons: " + icons.length);
23            for (k = 0; k < icons.length; k++) {
24                DescribeIcon icon = icons[k];
25                System.out.println("    For Icon #" + k + ":");
26                System.out.println("      ContentType: " + icon.getContentType());
27                System.out.println("      Height: " + icon.getHeight());
28                System.out.println("      Theme: " + icon.getTheme());
29                System.out.println("      URL: " + icon.getUrl());
30                System.out.println("      Width: " + icon.getWidth());
31            }
32        }
33    } catch (ConnectionException ce) {
34        ce.printStackTrace();
35    }
36}
37