cocos_hex_to_rgba
Convert hex color codes to RGBA integer values for Cocos Creator game development, eliminating manual translation errors when using CSS or design tool colors.
Instructions
Convert #rrggbb / #rgb / #rrggbbaa to RGBA ints.
Returns {r, g, b, a} suitable for any tool that takes
color_r/color_g/color_b/color_a params.
Lets the caller paste CSS / design-tool hex codes without
hand-translating to int quadruples (a common source of off-by-one
color bugs).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"hex_color": "<hex_color>"
},
"name": "cocos_hex_to_rgba"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex_color | Yes | ||
| alpha | No |