WoW:API GetItemQualityColor: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Added details to explain how invalid arguments are handled)
Line 1: Line 1:
{{wowapi}}__NOTOC__
{{wowapi}}__NOTOC__
<center>'''GetItemQualityColor''' ''-Documentation by Maldivia-''</center>


Returns RGB color codes for an item quality.
Returns RGB color codes for an item quality.
Line 9: Line 8:
:quality
:quality


:;quality : Integer - The numeric ID of the quality from 0 (Poor) to 6 (Artifact).
:;quality : Integer - The numeric ID of the quality from 0 (Poor) to 7 (Heirloom).


=== Returns ===
=== Returns ===
Line 22: Line 21:
  for i = 0, 6 do
  for i = 0, 6 do
   local r, g, b, hex = GetItemQualityColor(i);
   local r, g, b, hex = GetItemQualityColor(i);
   DEFAULT_CHAT_FRAME:AddMessage(getglobal("ITEM_QUALITY" .. i .. "_DESC"), r, g, b);
   print(getglobal("ITEM_QUALITY" .. i .. "_DESC"), r, g, b);
  end
  end


====Result====
====Result====
: Will write all qualities to the default chat frame, in their individual colors.
: Will print all qualities, in their individual colors.


==Details==
==Details==

Revision as of 01:15, 19 September 2008

WoW API < GetItemQualityColor

Returns RGB color codes for an item quality.

r, g, b, hex = GetItemQualityColor(quality)

Parameters

Arguments

quality
quality
Integer - The numeric ID of the quality from 0 (Poor) to 7 (Heirloom).

Returns

r, g, b, hex
r
Float - The Red component of the color
g
Float - The Green component of the color
b
Float - The Blue component of the color
hex
String - Contains the hexidecimal representation of the string, as well as "|c" in the beginning.

Example

for i = 0, 6 do
  local r, g, b, hex = GetItemQualityColor(i);
  print(getglobal("ITEM_QUALITY" .. i .. "_DESC"), r, g, b);
end

Result

Will print all qualities, in their individual colors.

Details

GetItemQualityColor() was added in 1.9.1
If an invalid quality index is specified, GetItemQualityColor() returns white (same as index 1):
r = 1
g = 1
b = 1
hex = |cffffffff