Office.ThemeId enum

指定当前选择的 Office 主题。

有关 Office 主题的信息,请参阅 更改 Microsoft 365 的外观。

注解

使用方

示例

// The following example sets the color of a heading based on the current Office theme.
function setHeadingColor() {
    // Identify the current Office theme in use.
    const currentOfficeTheme = Office.context.officeTheme.themeId;

    if (currentOfficeTheme === Office.ThemeId.Colorful) {
        $("h1").css("color", "#1849ff");
    }

    ...
}

字段

Black

当前选择的 Office 主题为“ 黑色”。

Colorful

当前选定的 Office 主题为 彩色

DarkGray

当前选择的 Office 主题为 深灰色

White

当前选择的 Office 主题为 白色