> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# ImGuiWindow.ColorPicker

> Appends a RGBA color editor to an ImGuiWindow and stores the callback. Missing or nil color components default to 1.0. When the rendered editor changes, the callback is queued and later invoked with red, green, blue, and alpha. The method returns the same ImGuiWindow object.

<div className="real-function-page">
  ```lua theme={null}
  ImGuiWindow.ColorPicker(window: ImGuiWindow, label: string, red?: number, green?: number, blue?: number, alpha?: number, onChange: function): ImGuiWindow
  ```

  ## Đối số

  <ParamField path={"window"} type={"ImGuiWindow"} required>
    ImGuiWindow object returned by imgui.create. A destroyed or invalid window raises a Lua error.
  </ParamField>

  <ParamField path={"label"} type={"string"} required>
    Color editor label string passed to the rendered ImGui ColorEdit4 widget.
  </ParamField>

  <ParamField path={"red"} type={"number"}>
    Initial red component read with luaL\_optnumber; defaults to 1.0 when omitted or nil.
  </ParamField>

  <ParamField path={"green"} type={"number"}>
    Initial green component read with luaL\_optnumber; defaults to 1.0 when omitted or nil.
  </ParamField>

  <ParamField path={"blue"} type={"number"}>
    Initial blue component read with luaL\_optnumber; defaults to 1.0 when omitted or nil.
  </ParamField>

  <ParamField path={"alpha"} type={"number"}>
    Initial alpha component read with luaL\_optnumber; defaults to 1.0 when omitted or nil.
  </ParamField>

  <ParamField path={"onChange"} type={"function"} required>
    Function stored for this color editor and invoked with red, green, blue, and alpha after a change event is processed. It must be supplied as argument 7.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"window"} type={"ImGuiWindow"}>
    The same ImGuiWindow object, allowing chained method calls.
  </ResponseField>

  ## Kiểu

  ### ImGuiWindow

  Xử lý được trả về bởi imgui.create. Các phương pháp xây dựng điều khiển trả về cùng một thẻ điều khiển để các cuộc gọi có thể được xâu chuỗi.

  | Name               | Type                                                                                                                                            | Required | Mô tả                                                                                       |
  | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------- |
  | `Button`           | `(label: string, onClick: () -> ()) -> ImGuiWindow`                                                                                             | Yes      | Nối thêm một nút và gọi lại lệnh gọi lại sau một cú nhấp chuột.                             |
  | `Checkbox`         | `(label: string, checked: any, onChange: (boolean) -> ()) -> ImGuiWindow`                                                                       | Yes      | Nối một hộp kiểm được khởi tạo vào trạng thái được cung cấp.                                |
  | `CollapsingHeader` | `(label: string, content: (ImGuiWindow) -> ()) -> ImGuiWindow`                                                                                  | Yes      | Các điều khiển nhóm được thêm vào bởi lệnh gọi lại nội dung bên dưới tiêu đề thu gọn.       |
  | `ColorPicker`      | `(label: string, red: number?, green: number?, blue: number?, alpha: number?, onChange: (number, number, number, number) -> ()) -> ImGuiWindow` | Yes      | Nối thêm trình soạn thảo RGBA; các thành phần màu bị bỏ qua mặc định là 1.0.                |
  | `InputText`        | `(label: string, text: string?, onChange: (string) -> ()) -> ImGuiWindow`                                                                       | Yes      | Nối thêm kiểu nhập văn bản một dòng; văn bản ban đầu bị bỏ qua mặc định là một chuỗi trống. |
  | `SameLine`         | `() -> ImGuiWindow`                                                                                                                             | Yes      | Đặt điều khiển tiếp theo trên cùng một dòng.                                                |
  | `Separator`        | `() -> ImGuiWindow`                                                                                                                             | Yes      | Nối thêm một dấu phân cách ngang.                                                           |
  | `SliderFloat`      | `(label: string, value: number, minimum: number, maximum: number, onChange: (number) -> ()) -> ImGuiWindow`                                     | Yes      | Nối thêm một thanh trượt dấu phẩy động.                                                     |
  | `SliderInt`        | `(label: string, value: integer, minimum: integer, maximum: integer, onChange: (number) -> ()) -> ImGuiWindow`                                  | Yes      | Nối thêm một thanh trượt số nguyên.                                                         |
  | `Text`             | `(text: string) -> ImGuiWindow`                                                                                                                 | Yes      | Nối thêm văn bản không tương tác.                                                           |
  | `destroy`          | `() -> ()`                                                                                                                                      | Yes      | Xóa cửa sổ và giải phóng các cuộc gọi lại đã đăng ký của nó.                                |
</div>
