Office.OfficeTheme interface

Office テーマの色のプロパティにアクセスできるようにします。

Office テーマの色を使用すると、すべての Office アプリケーションに適用されるファイル>Office アカウント> Officeテーマ UI を使用して、ユーザーが選択した現在の Office テーマとアドインの配色を調整できます。 Using Office theme colors is appropriate for mail and task pane add-ins.

注釈

サポートされているアプリケーション (プラットフォーム別)

Windows での Office Office on the web Office on Mac iOS 上の Office Android 上の Office
Excel サポート 利用不可 サポート サポート 利用不可
Outlook Preview 使用不可 使用不可 使用不可 使用不可
PowerPoint サポート 利用不可 サポート サポート 利用不可
Word サポート サポート サポート サポート 利用不可

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);
}

プロパティ

bodyBackgroundColor

Office テーマ本体の背景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

bodyForegroundColor

Office テーマ本体の前景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

controlBackgroundColor

Office テーマ コントロールの背景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

controlForegroundColor

Office テーマ コントロールの前景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

プロパティの詳細

bodyBackgroundColor

Office テーマ本体の背景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

bodyBackgroundColor: string;

プロパティ値

string

bodyForegroundColor

Office テーマ本体の前景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

bodyForegroundColor: string;

プロパティ値

string

controlBackgroundColor

Office テーマ コントロールの背景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

controlBackgroundColor: string;

プロパティ値

string

controlForegroundColor

Office テーマ コントロールの前景色を 16 進色のトリプレット ("#FFA500" など) として取得します。

controlForegroundColor: string;

プロパティ値

string