Class ThemeColor
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
详细文档
getColorType()
获取此颜色的类型。
返回
ColorType
- 颜色类型。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getThemeColorType()
获取此颜色的主题颜色类型。
返回
ThemeColorType
- 主题颜色类型。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eThemeColor\u003c/code\u003e represents a theme color within Google Apps Script and provides methods for interacting with it.\u003c/p\u003e\n"],["\u003cp\u003eIt offers two methods: \u003ccode\u003egetColorType()\u003c/code\u003e to determine the color's type (e.g., RGB, HEX) and \u003ccode\u003egetThemeColorType()\u003c/code\u003e to identify its specific theme color type (e.g., ACCENT1, TEXT1).\u003c/p\u003e\n"],["\u003cp\u003eBoth methods require authorization with scopes such as \u003ccode\u003ehttps://www.googleapis.com/auth/spreadsheets.currentonly\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/spreadsheets\u003c/code\u003e before use.\u003c/p\u003e\n"]]],["ThemeColor provides a representation for a theme color. Key actions involve retrieving color information: `getColorType()` returns the color's type, and `getThemeColorType()` returns the specific theme color type. Both methods require authorization scopes `https://www.googleapis.com/auth/spreadsheets.currentonly` or `https://www.googleapis.com/auth/spreadsheets` to be used within scripts.\n"],null,["# Class ThemeColor\n\nThemeColor\n\nA representation for a theme color. \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------|-----------------------------------------------------------------------|------------------------------------------|\n| [getColorType()](#getColorType()) | [ColorType](../base/color-type.html) | Get the type of this color. |\n| [getThemeColorType()](#getThemeColorType()) | [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) | Gets the theme color type of this color. |\n\nDetailed documentation\n----------------------\n\n### `get``Color``Type()`\n\nGet the type of this color.\n\n#### Return\n\n\n[ColorType](../base/color-type.html) --- The color type.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Theme``Color``Type()`\n\nGets the theme color type of this color.\n\n#### Return\n\n\n[ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) --- The theme color type.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`"]]