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 the web | Office on Windows | Office on Mac | Office on iOS | Office on Android | |
---|---|---|---|---|---|
Excel | Not available | Supported | Supported | Supported | Not available |
Outlook | Not available | Preview | Not available | Not available | Not available |
PowerPoint | Not available | Supported | 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
body |
Gets the Office theme body background color as a hexadecimal color triplet (e.g., "#FFA500"). |
body |
Gets the Office theme body foreground color as a hexadecimal color triplet (e.g., "#FFA500"). |
control |
Gets the Office theme control background color as a hexadecimal color triplet (e.g., "#FFA500"). |
control |
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
Office Add-ins
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for