Class ColorScheme

ColorScheme

配色方案定义了从 ThemeColorType 成员到用于渲染它们的实际颜色的映射。

方法

方法返回类型简介
getConcreteColor(theme)Color返回与此配色方案中的 ThemeColorType 相关联的具体 Color
getThemeColors()ThemeColorType[]返回配色方案中所有可能的主题颜色类型的列表。
setConcreteColor(type, color)ColorScheme将与此配色方案中的 ThemeColorType 相关联的具体颜色设为指定颜色。
setConcreteColor(type, red, green, blue)ColorScheme将与此配色方案中的 ThemeColorType 相关联的具体颜色设为 RGB 格式的指定颜色。
setConcreteColor(type, hexColor)ColorScheme将与此配色方案中的 ThemeColorType 关联的具体颜色设置为十六进制格式的指定颜色。

详细文档

getConcreteColor(theme)

返回与该配色方案中的 ThemeColorType 相关联的具体 Color

返回的颜色肯定不是 ThemeColor 的实例。

参数

名称类型说明
themeThemeColorType用于派生具体颜色的主题颜色。

返回

Color - 与此方案中的主题颜色类型对应的具体颜色。

授权

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

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

getThemeColors()

返回配色方案中所有可能的主题颜色类型的列表。

返回

ThemeColorType[] - 此方案可能使用的主题颜色类型。

授权

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

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

setConcreteColor(type, color)

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

参数

名称类型说明
typeThemeColorType主题颜色类型。
colorColor要将主题颜色类型设为的颜色。

返回

ColorScheme - 此配色方案。

授权

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

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

setConcreteColor(type, red, green, blue)

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

参数

名称类型说明
typeThemeColorType主题颜色类型。
redInteger将主题颜色类型设置为 (介于 0 到 255 之间)的颜色的红色值。
greenInteger用于设置主题颜色类型的颜色的绿色值(介于 0 和 255 之间)。
blueInteger用于设置主题颜色类型的颜色的蓝色值(介于 0 和 255 之间)。

返回

ColorScheme - 此配色方案。

授权

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

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

setConcreteColor(type, hexColor)

将与此颜色方案中的 ThemeColorType 关联的具体颜色设置为十六进制格式的指定颜色。

十六进制字符串的格式必须为 '#RRGGBB'。

参数

名称类型说明
typeThemeColorType主题颜色类型。
hexColorString要设置主题颜色类型的十六进制颜色,例如 '#F304a7'。

返回

ColorScheme - 此配色方案。

授权

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

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