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 applications. Using Office theme colors is appropriate for mail and task pane add-ins.

Remarks

Supported applications, by platform

Office on Windows Office on the web Office on Mac Office on iOS Office on Android
Excel Supported Not available Supported Supported Not available
Outlook Preview Not available Not available Not available Not available
PowerPoint Supported Not available Supported Supported Not available
Word Supported Supported Supported Supported Not available

Examples

function applyOfficeTheme(){
    // Get office theme colors.
    const bodyBackgroundColor = Office.context.officeTheme.bodyBackgroundColor;
    const bodyForegroundColor = Office.context.officeTheme.bodyForegroundColor;
    const controlBackgroundColor = Office.context.officeTheme.controlBackgroundColor;
    const 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