Class ColorBuilder
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
مستندات تفصيلية
asRgbColor()
لتحويل هذا اللون إلى RgbColor
.
الإرجاع
RgbColor
: لون RGB
عمليات الرمي
Error
- إذا لم يكن اللون RgbColor
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
asThemeColor()
لتحويل هذا اللون إلى ThemeColor
.
الإرجاع
ThemeColor
: لون المظهر
عمليات الرمي
Error
- إذا لم يكن اللون ThemeColor
.
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
build()
تُنشئ عنصر لون من الإعدادات المقدَّمة إلى أداة الإنشاء.
الإرجاع
Color
: كائن لون تم إنشاؤه من هذا المُنشئ
getColorType()
الحصول على نوع هذا اللون
الإرجاع
ColorType
: نوع اللون
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setRgbColor(cssString)
لضبط اللون على نموذج أحمر أخضر أزرق
المعلَمات
الاسم | النوع | الوصف |
cssString | String | لون RGB بترميز CSS (مثل #ffffff) |
الإرجاع
ColorBuilder
: هذا المُنشئ، لتسلسل العناصر.
setThemeColor(themeColorType)
يتم ضبطه على أنّه لون التصميم.
المعلَمات
الإرجاع
ColorBuilder
: هذا المُنشئ، لتسلسل العناصر.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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."]]