تنظيم صفحاتك في مجموعات يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
التدرّجالحالة
الوصول إلى شروط التدرّج (اللون) في ConditionalFormatRuleApis يمكن أن تحتوي كل قاعدة تنسيق شرطي على شرط تدرّج واحد. يتم تحديد شرط التدرّج من خلال ثلاث نقاط على مقياس أرقام (الحد الأدنى والمتوسط والأقصى)، ولكل منها لون وقيمة وInterpolationType. تتم مقارنة محتوى الخلية بالقيم في مقياس الأرقام، ويتم تطبيق اللون على الخلية استنادًا إلى مدى قرب محتوى الخلية من الحد الأدنى والمتوسط والأقصى لنقاط شرط التدرج.
// Logs all the information inside gradient conditional format rules on a sheet.// The below snippet assumes all colors have ColorType.RGB.constsheet=SpreadsheetApp.getActiveSheet();construles=sheet.getConditionalFormatRules();for(leti=0;i < rules.length;i++){constgradient=rules[i].getGradientCondition();constminColor=gradient.getMinColorObject().asRgbColor().asHexString();constminType=gradient.getMinType();constminValue=gradient.getMinValue();constmidColor=gradient.getMidColorObject().asRgbColor().asHexString();constmidType=gradient.getMidType();constmidValue=gradient.getMidValue();constmaxColor=gradient.getMaxColorObject().asRgbColor().asHexString();constmaxType=gradient.getMaxType();constmaxValue=gradient.getMaxValue();Logger.log(`The conditional format gradient information for rule ${i}: MinColor ${minColor}, MinType ${minType}, MinValue ${minValue}, MidColor ${midColor}, MidType ${midType}, MidValue ${midValue}, MaxColor ${maxColor}, MaxType ${maxType}, MaxValue ${maxValue}`);}
تعرض هذه السمة مجموعة الألوان التي تم ضبطها للحد الأدنى لقيمة شرط التدرّج هذا.
مستندات مفصّلة
getMaxColorObject()
تعرض هذه السمة مجموعة الألوان التي تم ضبطها للحد الأقصى لقيمة شرط التدرّج هذا. تعرض null إذا لم يتم ضبط اللون.
الإرجاع
Color: اللون الذي تم ضبطه للحد الأقصى لقيمة شرط التدرّج هذا أو null
getMaxType()
تعرض هذه السمة نوع الاستيفاء للحد الأقصى لقيمة شرط التدرّج هذا. تعرِض هذه السمة القيمة null إذا لم يتم ضبط نوع الحد الأقصى للتدرّج.
الإرجاع
InterpolationType: نوع الاستيفاء للحد الأقصى لقيمة شرط التدرّج هذا أو null
getMaxValue()
تعرض هذه السمة الحد الأقصى لقيمة شرط التدرّج هذا. تعرض هذه الدالة سلسلة فارغة إذا كانت قيمة InterpolationType هي MAX أو إذا لم يتم ضبط الحد الأقصى للقيمة.
الإرجاع
String: الحد الأقصى للقيمة إذا تم تحديده أو سلسلة فارغة
getMidColorObject()
تعرض هذه السمة مجموعة الألوان للقيمة المتوسطة لشرط التدرّج هذا. تعرض null إذا لم يتم ضبط اللون.
الإرجاع
Color: مجموعة الألوان التي تم ضبطها للقيمة المتوسطة لشرط التدرّج هذا أو null
getMidType()
تعرض هذه السمة نوع الاستيفاء لقيمة نقطة المنتصف لشرط التدرّج هذا. تعرِض هذه السمة القيمة null إذا لم يتم ضبط نوع التدرّج اللوني المتوسط.
الإرجاع
InterpolationType: نوع الاستيفاء لقيمة نقطة المنتصف لشرط التدرّج هذا أو null.
getMidValue()
تعرض هذه السمة قيمة نقطة الوسط لشرط التدرّج هذا. تعرِض هذه السمة سلسلة فارغة إذا لم يتم ضبط قيمة منتصف التدرّج.
الإرجاع
String: تمثّل هذه السمة قيمة نقطة الوسط أو سلسلة فارغة.
getMinColorObject()
تعرض هذه السمة مجموعة الألوان التي تم ضبطها للحد الأدنى لقيمة شرط التدرّج هذا. تعرض null إذا لم يتم ضبط اللون.
الإرجاع
Color: اللون الذي تم ضبطه للحد الأدنى لقيمة شرط التدرّج هذا أو null
getMinType()
تعرض هذه السمة نوع الاستيفاء للحد الأدنى لقيمة شرط التدرّج هذا. تعرِض القيمة null إذا لم يتم ضبط الحد الأدنى لنوع التدرّج.
الإرجاع
InterpolationType: نوع الاستيفاء للحد الأدنى لقيمة شرط التدرّج هذا أو null
getMinValue()
تعرض هذه السمة الحد الأدنى لقيمة شرط التدرّج هذا. تعرض هذه الدالة سلسلة فارغة إذا كانت قيمة InterpolationType هي MIN أو إذا لم يتم ضبط الحد الأدنى للقيمة.
الإرجاع
String: الحد الأدنى للقيمة إذا تم تحديدها أو سلسلة فارغة
تاريخ التعديل الأخير: 2025-08-05 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-05 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eGradient conditions in Google Sheets allow you to apply color scales to cells based on their values, interpolating colors between minimum, midpoint, and maximum points.\u003c/p\u003e\n"],["\u003cp\u003eEach gradient condition is defined by three points (min, mid, max), each having a color, value, and interpolation type.\u003c/p\u003e\n"],["\u003cp\u003eYou can access and manipulate gradient conditions programmatically using Apps Script methods like \u003ccode\u003egetMinColorObject()\u003c/code\u003e, \u003ccode\u003egetMidValue()\u003c/code\u003e, and \u003ccode\u003egetMaxType()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDeprecated methods like \u003ccode\u003egetMinColor()\u003c/code\u003e, \u003ccode\u003egetMidColor()\u003c/code\u003e, and \u003ccode\u003egetMaxColor()\u003c/code\u003e have been replaced by object-based alternatives for color retrieval.\u003c/p\u003e\n"]]],["Gradient conditions, within conditional format rules, define cell colors based on a number scale with minimum, midpoint, and maximum values. Each point has a color, value, and interpolation type. Methods like `getMinColorObject()`, `getMidType()`, and `getMaxValue()` retrieve these attributes. Cell content is compared to these values to interpolate and apply a corresponding color. Deprecated methods (`getMinColor()`, `getMidColor()`, `getMaxColor()`) are replaced with `get[Point]ColorObject()`.\n"],null,["GradientCondition\n\nAccess gradient (color) conditions in [ConditionalFormatRuleApis](/apps-script/reference/spreadsheet/conditional-format-rule).\nEach conditional format rule may contain a single gradient condition. A gradient condition is\ndefined by three points along a number scale (min, mid, and max), each of which has a color, a\nvalue, and a [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type). The content of a cell is\ncompared to the values in the number scale and the color applied to the cell is interpolated\nbased on the cell content's proximity to the gradient condition min, mid, and max points.\n\n```javascript\n// Logs all the information inside gradient conditional format rules on a sheet.\n// The below snippet assumes all colors have ColorType.RGB.\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst rules = sheet.getConditionalFormatRules();\nfor (let i = 0; i \u003c rules.length; i++) {\n const gradient = rules[i].getGradientCondition();\n\n const minColor = gradient.getMinColorObject().asRgbColor().asHexString();\n const minType = gradient.getMinType();\n const minValue = gradient.getMinValue();\n const midColor = gradient.getMidColorObject().asRgbColor().asHexString();\n const midType = gradient.getMidType();\n const midValue = gradient.getMidValue();\n const maxColor = gradient.getMaxColorObject().asRgbColor().asHexString();\n const maxType = gradient.getMaxType();\n const maxValue = gradient.getMaxValue();\n\n Logger.log(`The conditional format gradient information for rule ${i}:\n MinColor ${minColor}, MinType ${minType}, MinValue ${minValue},\n MidColor ${midColor}, MidType ${midType}, MidValue ${midValue},\n MaxColor ${maxColor}, MaxType ${maxType}, MaxValue ${maxValue}`);\n}\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|---------------------------------------------|----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [getMaxColorObject()](#getMaxColorObject()) | [Color](/apps-script/reference/spreadsheet/color) | Gets the color set for the maximum value of this gradient condition. |\n| [getMaxType()](#getMaxType()) | [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) | Gets the interpolation type for the maximum value of this gradient condition. |\n| [getMaxValue()](#getMaxValue()) | `String` | Gets the max value of this gradient condition. |\n| [getMidColorObject()](#getMidColorObject()) | [Color](/apps-script/reference/spreadsheet/color) | Gets the color set for the midpoint value of this gradient condition. |\n| [getMidType()](#getMidType()) | [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) | Gets the interpolation type for the mid-point value of this gradient condition. |\n| [getMidValue()](#getMidValue()) | `String` | Gets the mid-point value of this gradient condition. |\n| [getMinColorObject()](#getMinColorObject()) | [Color](/apps-script/reference/spreadsheet/color) | Gets the color set for the minimum value of this gradient condition. |\n| [getMinType()](#getMinType()) | [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) | Gets the interpolation type for the minimum value of this gradient condition. |\n| [getMinValue()](#getMinValue()) | `String` | Gets the minimum value of this gradient condition. |\n\nDeprecated methods\n\n| Method | Return type | Brief description |\n|---------------------------------|-------------|------------------------------------------------------------------------|\n| [getMaxColor()](#getMaxColor()) | `String` | Gets the color set for the maximum value of this gradient condition. |\n| [getMidColor()](#getMidColor()) | `String` | Gets the color set for the mid-point value of this gradient condition. |\n| [getMinColor()](#getMinColor()) | `String` | Gets the color set for the minimum value of this gradient condition. |\n\nDetailed documentation \n\n`get``Max``Color``Object()` \nGets the color set for the maximum value of this gradient condition. Returns `null` if\nthe color hasn't been set.\n\nReturn\n\n\n[Color](/apps-script/reference/spreadsheet/color) --- The color set for the maximum value of this gradient condition or `null`.\n\n*** ** * ** ***\n\n`get``Max``Type()` \nGets the interpolation type for the maximum value of this gradient condition. Returns `null` if the gradient max type hasn't been set.\n\nReturn\n\n\n[InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) --- the interpolation type for the maximum value of this gradient condition or `null`\n\n*** ** * ** ***\n\n`get``Max``Value()` \nGets the max value of this gradient condition. Returns an empty string if the [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) is `MAX` or if the max value hasn't been\nset.\n\nReturn\n\n\n`String` --- the maximum value if specified or an empty string\n\n*** ** * ** ***\n\n`get``Mid``Color``Object()` \nGets the color set for the midpoint value of this gradient condition. Returns `null` if\nthe color hasn't been set.\n\nReturn\n\n\n[Color](/apps-script/reference/spreadsheet/color) --- The color set for the midpoint value of this gradient condition or `null`.\n\n*** ** * ** ***\n\n`get``Mid``Type()` \nGets the interpolation type for the mid-point value of this gradient condition. Returns `null` if the gradient mid type hasn't been set.\n\nReturn\n\n\n[InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) --- the interpolation type for the mid-point value of this gradient condition or `null`\n\n*** ** * ** ***\n\n`get``Mid``Value()` \nGets the mid-point value of this gradient condition. Returns an empty string if the gradient\nmid value hasn't been set.\n\nReturn\n\n\n`String` --- the mid-point value or an empty string\n\n*** ** * ** ***\n\n`get``Min``Color``Object()` \nGets the color set for the minimum value of this gradient condition. Returns `null` if\nthe color hasn't been set.\n\nReturn\n\n\n[Color](/apps-script/reference/spreadsheet/color) --- The color set for the minimum value of this gradient condition or `null`.\n\n*** ** * ** ***\n\n`get``Min``Type()` \nGets the interpolation type for the minimum value of this gradient condition. Returns `null` if the gradient min type hasn't been set.\n\nReturn\n\n\n[InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) --- the interpolation type for the minimum value of this gradient condition or `null`\n\n*** ** * ** ***\n\n`get``Min``Value()` \nGets the minimum value of this gradient condition. Returns an empty string if the [InterpolationType](/apps-script/reference/spreadsheet/interpolation-type) is `MIN` or if the min value hasn't been\nset.\n\nReturn\n\n\n`String` --- the minimum value if specified or an empty string\n\nDeprecated methods \n\n`get``Max``Color()` \n\n**Deprecated.** Replaced by [getMaxColorObject()](#getMaxColorObject())\n\nGets the color set for the maximum value of this gradient condition. Returns an empty string if\nthe color hasn't been set.\n\nReturn\n\n\n`String` --- The color set for the maximum value of this gradient condition or an empty string.\n\n*** ** * ** ***\n\n`get``Mid``Color()` \n\n**Deprecated.** Replaced by [getMidColorObject()](#getMidColorObject())\n\nGets the color set for the mid-point value of this gradient condition. Returns an empty string\nif the color hasn't been set.\n\nReturn\n\n\n`String` --- The color set for the midpoint value of this gradient condition or an empty string.\n\n*** ** * ** ***\n\n`get``Min``Color()` \n\n**Deprecated.** Replaced by [getMinColorObject()](#getMinColorObject())\n\nGets the color set for the minimum value of this gradient condition. Returns an empty string if\nthe color hasn't been set.\n\nReturn\n\n\n`String` --- The color set for the minimum value of this gradient condition or an empty string."]]