Class ColorBuilder
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Подробная документация
as Rgb Color()
Преобразует этот цвет в Rgb Color
.
Возвращаться
Rgb Color
— цвет RGB.
Броски
Error
— если цвет не является Rgb Color
Авторизация
Сценарии, использующие этот метод, требуют авторизации с одной или несколькими из следующих областей :
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
as Theme Color()
Преобразует этот цвет в Theme Color
.
Возвращаться
Theme Color
— цвет темы.
Броски
Error
— если цвет не является Theme Color
.
Авторизация
Сценарии, использующие этот метод, требуют авторизации с одной или несколькими из следующих областей :
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
build()
Создает цветной объект на основе настроек, предоставленных строителю.
Возвращаться
Color
— цветной объект, созданный с помощью этого конструктора.
get Color Type()
Получите тип этого цвета.
Возвращаться
Color Type
— Цветотип.
Авторизация
Сценарии, использующие этот метод, требуют авторизации с одной или несколькими из следующих областей :
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
set Rgb Color(cssString)
Устанавливается как цвет RGB.
Параметры
Имя | Тип | Описание |
---|
css String | String | Цвет RGB в нотации CSS (например, «#ffffff»). |
Возвращаться
Color Builder
— этот конструктор для создания цепочек.
set Theme Color(themeColorType)
Устанавливается как цвет темы.
Параметры
Возвращаться
Color Builder
— этот конструктор для создания цепочек.
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003eColorBuilder\u003c/code\u003e facilitates the creation and customization of color objects within Google Sheets using Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eMethods such as \u003ccode\u003esetRgbColor()\u003c/code\u003e and \u003ccode\u003esetThemeColor()\u003c/code\u003e are used to define the color, while \u003ccode\u003ebuild()\u003c/code\u003e generates the final \u003ccode\u003eColor\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003easRgbColor()\u003c/code\u003e and \u003ccode\u003easThemeColor()\u003c/code\u003e methods enable the conversion of the color to specific color types.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetColorType()\u003c/code\u003e reveals the color's current type (RGB or Theme).\u003c/p\u003e\n"],["\u003cp\u003eSeveral of these methods necessitate authorization with relevant scopes for access to spreadsheet data.\u003c/p\u003e\n"]]],["ColorBuilder facilitates creating color objects using `SpreadsheetApp.newColor()`. It allows conversion to `RgbColor` or `ThemeColor`. Key actions include `build()` to create a color object, `getColorType()` to retrieve the color type, `setRgbColor(cssString)` to define an RGB color, and `setThemeColor(themeColorType)` to define a theme color. Methods may require specific authorization scopes like `spreadsheets.currentonly` or `spreadsheets`. The builder can be chained.\n"],null,["# Class ColorBuilder\n\nColorBuilder\n\nThe builder for [ColorBuilder](#). To create a new builder, use [SpreadsheetApp.newColor()](/apps-script/reference/spreadsheet/spreadsheet-app#newColor()). \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------|--------------------------------------------------------------|----------------------------------------------------------------------------------------|\n| [asRgbColor()](#asRgbColor()) | [RgbColor](../base/rgb-color.html) | Converts this color to an [RgbColor](../base/rgb-color.html). |\n| [asThemeColor()](#asThemeColor()) | [ThemeColor](/apps-script/reference/spreadsheet/theme-color) | Converts this color to a [ThemeColor](/apps-script/reference/spreadsheet/theme-color). |\n| [build()](#build()) | [Color](/apps-script/reference/spreadsheet/color) | Creates a color object from the settings supplied to the builder. |\n| [getColorType()](#getColorType()) | [ColorType](../base/color-type.html) | Get the type of this color. |\n| [setRgbColor(cssString)](#setRgbColor(String)) | [ColorBuilder](#) | Sets as RGB color. |\n| [setThemeColor(themeColorType)](#setThemeColor(ThemeColorType)) | [ColorBuilder](#) | Sets as theme color. |\n\nDetailed documentation\n----------------------\n\n### `as``Rgb``Color()`\n\nConverts this color to an [RgbColor](../base/rgb-color.html).\n\n#### Return\n\n\n[RgbColor](../base/rgb-color.html) --- The RGB color.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not an [RgbColor](../base/rgb-color.html)\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### `as``Theme``Color()`\n\nConverts this color to a [ThemeColor](/apps-script/reference/spreadsheet/theme-color).\n\n#### Return\n\n\n[ThemeColor](/apps-script/reference/spreadsheet/theme-color) --- The theme color.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not a [ThemeColor](/apps-script/reference/spreadsheet/theme-color).\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### `build()`\n\nCreates a color object from the settings supplied to the builder.\n\n#### Return\n\n\n[Color](/apps-script/reference/spreadsheet/color) --- A color object created from this builder.\n\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### `set``Rgb``Color(cssString)`\n\nSets as RGB color.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------|----------------------------------------------------|\n| `css``String` | `String` | The RGB color in CSS notation (such as '#ffffff'). |\n\n#### Return\n\n\n[ColorBuilder](#) --- This builder, for chaining.\n\n*** ** * ** ***\n\n### `set``Theme``Color(themeColorType)`\n\nSets as theme color.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------------------|-----------------------------------------------------------------------|-----------------------|\n| `theme``Color``Type` | [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) | The theme color type. |\n\n#### Return\n\n\n[ColorBuilder](#) --- This builder, for chaining."]]