Class ColorBuilder
เอกสารประกอบโดยละเอียด
asRgbColor()
แปลงสีนี้เป็น RgbColor
รีเทิร์น
RgbColor
— สี RGB
โยน
Error
— หากสีไม่ใช่ RgbColor
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
asThemeColor()
แปลงสีนี้เป็น ThemeColor
รีเทิร์น
ThemeColor
— สีธีม
โยน
Error
— หากสีไม่ใช่ ThemeColor
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
build()
สร้างออบเจ็กต์สีจากการตั้งค่าที่ระบุไว้ในโปรแกรมสร้าง
รีเทิร์น
Color
— ออบเจ็กต์สีที่สร้างจากเครื่องมือสร้างนี้
getColorType()
รับประเภทของสีนี้
รีเทิร์น
ColorType
— ประเภทสี
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setRgbColor(cssString)
ตั้งค่าเป็นสี RGB
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
cssString | String | สี RGB ในเครื่องหมายนิพจน์ CSS (เช่น "#ffffff") |
รีเทิร์น
ColorBuilder
— ตัวสร้างนี้สําหรับการต่อเชื่อม
setThemeColor(themeColorType)
ตั้งเป็นสีธีม
พารามิเตอร์
รีเทิร์น
ColorBuilder
— ตัวสร้างนี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-12-02 UTC
[null,null,["อัปเดตล่าสุด 2024-12-02 UTC"],[[["`ColorBuilder` facilitates the creation and customization of color objects within Google Sheets using Apps Script."],["Methods such as `setRgbColor()` and `setThemeColor()` are used to define the color, while `build()` generates the final `Color` object."],["`asRgbColor()` and `asThemeColor()` methods enable the conversion of the color to specific color types."],["`getColorType()` reveals the color's current type (RGB or Theme)."],["Several of these methods necessitate authorization with relevant scopes for access to spreadsheet data."]]],["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"]]