Office.OfficeTheme interface

Provides access to the properties for Office theme colors.

Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user with File > Office Account > Office Theme UI, which is applied across all Office host applications. Using Office theme colors is appropriate for mail and task pane add-ins.

Remarks

Hosts: Excel, Outlook (in preview), PowerPoint, Word

OfficeTheme is only supported in Office on Windows.

Examples

function applyOfficeTheme(){
    // Get office theme colors.
    var bodyBackgroundColor = Office.context.officeTheme.bodyBackgroundColor;
    var bodyForegroundColor = Office.context.officeTheme.bodyForegroundColor;
    var controlBackgroundColor = Office.context.officeTheme.controlBackgroundColor;
    var controlForegroundColor = Office.context.officeTheme.controlForegroundColor;

    // Apply body background color to a CSS class.
    $('.body').css('background-color', bodyBackgroundColor);
}

Properties

bodyBackgroundColor

Gets the Office theme body background color as a hexadecimal color triplet (e.g. "FFA500").

bodyForegroundColor

Gets the Office theme body foreground color as a hexadecimal color triplet (e.g. "FFA500").

controlBackgroundColor

Gets the Office theme control background color as a hexadecimal color triplet (e.g. "FFA500").

controlForegroundColor

Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500").

Property Details

bodyBackgroundColor

Gets the Office theme body background color as a hexadecimal color triplet (e.g. "FFA500").

bodyBackgroundColor: string;

Property Value

string

bodyForegroundColor

Gets the Office theme body foreground color as a hexadecimal color triplet (e.g. "FFA500").

bodyForegroundColor: string;

Property Value

string

controlBackgroundColor

Gets the Office theme control background color as a hexadecimal color triplet (e.g. "FFA500").

controlBackgroundColor: string;

Property Value

string

controlForegroundColor

Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500").

controlForegroundColor: string;

Property Value

string