Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Returns the color for an item quality.
r, g, b, hex = GetItemQualityColor(quality)
Arguments[]
- quality
- Enum.ItemQuality🔗
Returns[]
- r
- number - Red component of the color (0 to 1, inclusive).
- g
- number - Green component of the color (0 to 1, inclusive).
- b
- number - Blue component of the color (0 to 1, inclusive).
- hex
- string - UI escape sequence for this color, without the leading "|c".
Details[]
- It is recommended to use the global ITEM_QUALITY_COLORS table instead of repeatedly calling this function.
- In particular,
ITEM_QUALITY_COLORS[quality].hex
already includes the leading "|c" escape sequence whereas the fourth return value of this function does not.
- If an invalid quality index is specified, GetItemQualityColor() returns white (same as index 1):
- r = 1
- g = 1
- b = 1
- hex = |cffffffff
Example[]
for i = 0, 8 do
local r, g, b, hex = GetItemQualityColor(i)
print(i, '|c'..hex, _G["ITEM_QUALITY" .. i .. "_DESC"], string.sub(hex,3))
end
Result[]
- Will print all qualities, in their individual colors.
0 Poor 9d9d9d |
Patch changes[]
Patch 4.2.0 (2011-06-28): The fourth return value no longer includes the leading |c
.
Patch 1.9.1 (2006-01-10): Added.