Class Color
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
مستندات تفصيلية
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
getColorType()
الحصول على نوع هذا اللون
الإرجاع
ColorType
: نوع اللون
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eRepresents a color and provides methods for manipulation.\u003c/p\u003e\n"],["\u003cp\u003eOffers methods to convert between RGB and Theme color representations.\u003c/p\u003e\n"],["\u003cp\u003eAllows retrieval of the underlying color type (RGB or Theme).\u003c/p\u003e\n"],["\u003cp\u003eAll methods require authorization with specific scopes for Google Spreadsheets access.\u003c/p\u003e\n"]]],["The core content defines a \"Color\" representation with three methods. `asRgbColor()` converts the color to an `RgbColor`, returning the RGB color and throwing an error if it's not an `RgbColor`. `asThemeColor()` converts the color to a `ThemeColor`, returning the theme color and throwing an error if it's not a `ThemeColor`. `getColorType()` retrieves and returns the color's type as a `ColorType`. Each method requires specific authorization scopes.\n"],null,["# Class Color\n\nColor\n\nA representation for a color. \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| [getColorType()](#getColorType()) | [ColorType](../base/color-type.html) | Get the type of this 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### `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`"]]