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
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per