Class RgbColor
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
RgbMàu
Một màu được xác định bằng các kênh màu đỏ, xanh lục, xanh dương.
Phương thức
Phương thức | Loại dữ liệu trả về | Mô tả ngắn |
asHexString() | String | Trả về màu dưới dạng chuỗi thập lục phân gồm 7 ký tự theo kiểu CSS (#rrggbb) hoặc chuỗi thập lục phân gồm 9 ký tự (#aarrggbb). |
getBlue() | Integer | Kênh màu xanh dương của màu này, dưới dạng một số từ 0 đến 255. |
getColorType() | ColorType | Lấy loại màu này. |
getGreen() | Integer | Kênh màu xanh lục của màu này, dưới dạng một số từ 0 đến 255. |
getRed() | Integer | Kênh màu đỏ của màu này, dưới dạng một số từ 0 đến 255. |
Tài liệu chi tiết
asHexString()
Trả về màu dưới dạng chuỗi thập lục phân gồm 7 ký tự theo kiểu CSS (#rrggbb) hoặc chuỗi thập lục phân gồm 9 ký tự (#aarrggbb).
Cầu thủ trả bóng
String
– Biểu thị màu bằng mã thập lục phân.
getBlue()
Kênh màu xanh dương của màu này, dưới dạng một số từ 0 đến 255.
Cầu thủ trả bóng
Integer
– Giá trị của kênh màu xanh dương.
getColorType()
Lấy loại màu này.
Cầu thủ trả bóng
ColorType
– Loại màu.
getGreen()
Kênh màu xanh lục của màu này, dưới dạng một số từ 0 đến 255.
Cầu thủ trả bóng
Integer
– Giá trị của kênh màu xanh lục.
getRed()
Kênh màu đỏ của màu này, dưới dạng một số từ 0 đến 255.
Cầu thủ trả bóng
Integer
– Giá trị của kênh màu đỏ.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eRgbColor\u003c/code\u003e defines a color using red, green, and blue color channels.\u003c/p\u003e\n"],["\u003cp\u003eYou can get the individual red, green, and blue color channel values as integers ranging from 0 to 255.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003easHexString()\u003c/code\u003e method provides the color's hexadecimal representation, suitable for CSS use.\u003c/p\u003e\n"],["\u003cp\u003eIt is possible to determine the color type using the \u003ccode\u003egetColorType()\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# Class RgbColor\n\nRgbColor\n\nA color defined by red, green, blue color channels. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| [asHexString()](#asHexString()) | `String` | Returns the color as a CSS-style 7 character hexadecimal string (#rrggbb) or 9 character hexadecimal string (#aarrggbb). |\n| [getBlue()](#getBlue()) | `Integer` | The blue channel of this color, as a number from 0 to 255. |\n| [getColorType()](#getColorType()) | [ColorType](/apps-script/reference/base/color-type) | Get the type of this color. |\n| [getGreen()](#getGreen()) | `Integer` | The green channel of this color, as a number from 0 to 255. |\n| [getRed()](#getRed()) | `Integer` | The red channel of this color, as a number from 0 to 255. |\n\nDetailed documentation\n----------------------\n\n### `as``Hex``String()`\n\nReturns the color as a CSS-style 7 character hexadecimal string (#rrggbb) or 9 character\nhexadecimal string (#aarrggbb).\n\n#### Return\n\n\n`String` --- The hex representation of color.\n\n*** ** * ** ***\n\n### `get``Blue()`\n\nThe blue channel of this color, as a number from 0 to 255.\n\n#### Return\n\n\n`Integer` --- The value of blue channel.\n\n*** ** * ** ***\n\n### `get``Color``Type()`\n\nGet the type of this color.\n\n#### Return\n\n\n[ColorType](/apps-script/reference/base/color-type) --- The color type.\n\n*** ** * ** ***\n\n### `get``Green()`\n\nThe green channel of this color, as a number from 0 to 255.\n\n#### Return\n\n\n`Integer` --- The value of green channel.\n\n*** ** * ** ***\n\n### `get``Red()`\n\nThe red channel of this color, as a number from 0 to 255.\n\n#### Return\n\n\n`Integer` --- The value of red channel."]]