Class SpreadsheetTheme

电子表格主题

访问和修改现有主题。如需为电子表格设置主题,请使用 Spreadsheet.setSpreadsheetTheme(theme)

方法

方法返回类型简介
getConcreteColor(themeColorType)Color返回有效的主题颜色类型对应的具体 Color
getFontFamily()String返回主题的字体系列;如果主题是 null 主题,则返回 null
getThemeColors()ThemeColorType[]返回当前主题的所有可能主题颜色类型的列表。
setConcreteColor(themeColorType, color)SpreadsheetTheme将与此配色方案中的 ThemeColorType 相关联的具体颜色设为指定颜色。
setConcreteColor(themeColorType, red, green, blue)SpreadsheetTheme将与此配色方案中的 ThemeColorType 相关联的具体颜色设为 RGB 格式的指定颜色。
setFontFamily(fontFamily)SpreadsheetTheme设置主题的字体系列。

详细文档

getConcreteColor(themeColorType)

返回有效的主题颜色类型对应的具体 Color。如果当前主题背景中未设置主题背景颜色类型,则会抛出异常。

参数

名称类型说明
themeColorTypeThemeColorType主题颜色类型。

返回

Color - 混凝土颜色。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getFontFamily()

返回主题的字体系列;如果主题是 null 主题,则返回 null

返回

String - 主题字体系列。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getThemeColors()

返回当前主题的所有可能主题颜色类型的列表。

返回

ThemeColorType[] - 主题颜色列表。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setConcreteColor(themeColorType, color)

将与此配色方案中的 ThemeColorType 相关联的具体颜色设为指定颜色。

参数

名称类型说明
themeColorTypeThemeColorType主题颜色类型。
colorColor颜色。

返回

SpreadsheetTheme - 用于串联的主题。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setConcreteColor(themeColorType, red, green, blue)

将与此配色方案中的 ThemeColorType 相关联的具体颜色设为 RGB 格式的指定颜色。

参数

名称类型说明
themeColorTypeThemeColorType主题颜色类型。
redInteger红色通道的值。
greenInteger绿色通道的值。
blueInteger蓝色通道的值。

返回

SpreadsheetTheme - 用于串联的主题。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFontFamily(fontFamily)

设置主题的字体系列。

参数

名称类型说明
fontFamilyString新的主题字体系列。

返回

SpreadsheetTheme - 此主题,用于串联。

授权

使用此方法的脚本需要通过以下一个或多个范围进行授权:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets