Renvoie l'Color concrète pour un type de couleur de thème valide. Génère une exception si le type de couleur du thème n'est pas défini dans le thème actuel.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eSpreadsheetTheme\u003c/code\u003e object allows you to access and modify existing themes within a spreadsheet.\u003c/p\u003e\n"],["\u003cp\u003eYou can get and set theme colors using methods like \u003ccode\u003egetConcreteColor\u003c/code\u003e, \u003ccode\u003esetConcreteColor\u003c/code\u003e, and \u003ccode\u003egetThemeColors\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe font family of a theme can be retrieved and modified with \u003ccode\u003egetFontFamily\u003c/code\u003e and \u003ccode\u003esetFontFamily\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAll these methods require authorization with specific scopes, such as \u003ccode\u003ehttps://www.googleapis.com/auth/spreadsheets\u003c/code\u003e.\u003c/p\u003e\n"]]],["Spreadsheet themes can be accessed and modified using `Spreadsheet.setSpreadsheetTheme(theme)`. Key actions include retrieving the concrete color for a theme color type with `getConcreteColor(themeColorType)`, and obtaining the theme's font family using `getFontFamily()`. Users can obtain a list of theme color types with `getThemeColors()`. Themes can be altered by setting the color with `setConcreteColor()`, or setting the font family using `setFontFamily()`. Color settings can be in [Color] or RGB.\n"],null,["SpreadsheetTheme\n\nAccess and modify existing themes. To set a theme on a spreadsheet, use [Spreadsheet.setSpreadsheetTheme(theme)](/apps-script/reference/spreadsheet/spreadsheet#setSpreadsheetTheme(SpreadsheetTheme)). \n\nMethods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getConcreteColor(themeColorType)](#getConcreteColor(ThemeColorType)) | [Color](/apps-script/reference/spreadsheet/color) | Returns the concrete [Color](/apps-script/reference/spreadsheet/color) for a valid theme color type. |\n| [getFontFamily()](#getFontFamily()) | `String` | Returns the font family of the theme, or `null` if it's a `null` theme. |\n| [getThemeColors()](#getThemeColors()) | [ThemeColorType[]](/apps-script/reference/spreadsheet/theme-color-type) | Returns a list of all possible theme color types for the current theme. |\n| [setConcreteColor(themeColorType, color)](#setConcreteColor(ThemeColorType,Color)) | [SpreadsheetTheme](#) | Sets the concrete color associated with the [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) in this color scheme to the given color. |\n| [setConcreteColor(themeColorType, red, green, blue)](#setConcreteColor(ThemeColorType,Integer,Integer,Integer)) | [SpreadsheetTheme](#) | Sets the concrete color associated with the [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) in this color scheme to the given color in RGB format. |\n| [setFontFamily(fontFamily)](#setFontFamily(String)) | [SpreadsheetTheme](#) | Sets the font family for the theme. |\n\nDetailed documentation \n\n`get``Concrete``Color(themeColorType)` \nReturns the concrete [Color](/apps-script/reference/spreadsheet/color) for a valid theme color type. Throws exception if the theme\ncolor type is not set in the current theme.\n\nParameters\n\n| Name | Type | Description |\n|----------------------|-----------------------------------------------------------------------|-------------------|\n| `theme``Color``Type` | [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) | Theme color type. |\n\nReturn\n\n\n[Color](/apps-script/reference/spreadsheet/color) --- Concrete color.\n\nAuthorization\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``Font``Family()` \nReturns the font family of the theme, or `null` if it's a `null` theme.\n\nReturn\n\n\n`String` --- The theme font family.\n\nAuthorization\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``Colors()` \nReturns a list of all possible theme color types for the current theme.\n\nReturn\n\n\n[ThemeColorType[]](/apps-script/reference/spreadsheet/theme-color-type) --- A list of theme colors.\n\nAuthorization\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``Concrete``Color(themeColorType, color)` \nSets the concrete color associated with the [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) in this color scheme to the\ngiven color.\n\nParameters\n\n| Name | Type | Description |\n|----------------------|-----------------------------------------------------------------------|-----------------------|\n| `theme``Color``Type` | [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) | The theme color type. |\n| `color` | [Color](/apps-script/reference/spreadsheet/color) | The color. |\n\nReturn\n\n\n[SpreadsheetTheme](#) --- The theme, for chaining.\n\nAuthorization\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``Concrete``Color(themeColorType, red, green, blue)` \nSets the concrete color associated with the [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) in this color scheme to the\ngiven color in RGB format.\n\nParameters\n\n| Name | Type | Description |\n|----------------------|-----------------------------------------------------------------------|-----------------------------|\n| `theme``Color``Type` | [ThemeColorType](/apps-script/reference/spreadsheet/theme-color-type) | The theme color type. |\n| `red` | `Integer` | The value of red channel. |\n| `green` | `Integer` | The value of green channel. |\n| `blue` | `Integer` | The value of blue channel. |\n\nReturn\n\n\n[SpreadsheetTheme](#) --- The theme, for chaining.\n\nAuthorization\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``Font``Family(fontFamily)` \nSets the font family for the theme.\n\nParameters\n\n| Name | Type | Description |\n|----------------|----------|----------------------------|\n| `font``Family` | `String` | The new theme font family. |\n\nReturn\n\n\n[SpreadsheetTheme](#) --- This theme, for chaining.\n\nAuthorization\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`"]]