Class ColorBuilder
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
內容詳盡的說明文件
asRgbColor()
將這個顏色轉換為 RgbColor。
回攻員
RgbColor:RGB 顏色。
擲回
Error - if the color is not an 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)
設為 RGB 顏色。
參數
| 名稱 | 類型 | 說明 |
cssString | String | CSS 標記中的 RGB 顏色 (例如「#ffffff」)。 |
回攻員
ColorBuilder:這個建構工具用於串連。
setThemeColor(themeColorType)
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-04-13 (世界標準時間)。
[null,null,["上次更新時間:2026-04-13 (世界標準時間)。"],[],["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"]]