WoW:API GetItemQualityColor: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Source needed|reason=With {{legion-inline}} Legion, [[Heirloom]] color appears to have changed to <span style="color:#00CCFF;">aqua cyan (r 0, g 0.8 , b 1; R 0, G 204, B 255; #00CCFF)</span>.}}
{{wowapi}}__NOTOC__
{{wowapi}}__NOTOC__


Line 6: Line 5:
  r, g, b, hex = GetItemQualityColor(quality)
  r, g, b, hex = GetItemQualityColor(quality)
== Arguments ==
== Arguments ==
;quality : Number - The numeric ID of the quality from 0 (Poor) to 7 (Heirloom).
* quality (number) - The numeric ID of the quality from 0 (Poor) to 7 (Heirloom).


== Returns ==
== Returns ==
;r : Number - The Red component of the color (0 to 1, inclusive).
* r (number) - The Red component of the color (0 to 1, inclusive).
;g : Number - The Green component of the color (0 to 1, inclusive).
* g (number) - The Green component of the color (0 to 1, inclusive).
;b : Number - The Blue component of the color (0 to 1, inclusive).
* b (number) - The Blue component of the color (0 to 1, inclusive).
;hex : String - The 4 character hex [[UI escape sequences|UI escape sequence]] for this color.
* hex (string) - The 4 character hex [[UI escape sequences|UI escape sequence]] for this color
 


== Example ==
== Example ==
  for i = 0, 7 do
  for i = 0, 8 do
   local r, g, b, hex = GetItemQualityColor(i);
   local r, g, b, hex = GetItemQualityColor(i)
   print(i, hex, getglobal("ITEM_QUALITY" .. i .. "_DESC"), string.sub(hex,5));
   print(i, hex, _G["ITEM_QUALITY" .. i .. "_DESC"], hex:sub(5))
  end
  end


=== Result ===
=== Result ===
: Will print all qualities, in their individual colors (example result from version 3.1.1).
: Will print all qualities, in their individual colors (example result from version 6.2.4).
{{Example/Begin}}
0 <span style="color: #9d9d9d">Poor ff9d9d9d</span>
0 <span style="color: #9d9d9d">Poor ff9d9d9d</span><br />
1 <span style="color: #ffffff">Common ffffffff</span>
1 <span style="color: #ffffff">Common ffffffff</span><br />
2 <span style="color: #1eff00">Uncommon ff1eff00</span>
2 <span style="color: #1eff00">Uncommon ff1eff00</span><br />
3 <span style="color: #0070dd">Rare ff0070dd</span>
3 <span style="color: #0070dd">Rare ff0070dd</span><br />
4 <span style="color: #a335ee">Epic ffa335ee</span>
4 <span style="color: #a335ee">Epic ffa335ee</span><br />
5 <span style="color: #ff8000">Legendary ffff8000</span>
5 <span style="color: #ff8000">Legendary ffff8000</span><br />
6 <span style="color: #e6cc80">Artifact ffe6cc80</span>
6 <span style="color: #e6cc80">Artifact ffe6cc80</span><br />
7 <span style="color: #e6cc80">Heirloom ffe6cc80</span>
7 <span style="color: #e6cc80">Heirloom ffe6cc80</span> &larr; Pre-{{legion-inline}} Legion<br />
8 <span style="color: #00ccff">WoW Token ff00ccff</span>
7 <span style="color: #00ccff">Heirloom ff00ccff</span> &larr; {{legion-inline}} Legion{{fact}}<br />
8 <span style="color:#00ccff">WoW Token ff00ccff</span>{{fact}}
{{Example/End}}


== Details ==
== Details ==
: GetItemQualityColor() was added in [[Patch 1.9.1]]
: GetItemQualityColor() was added in 1.9.1


:If an invalid quality index is specified, GetItemQualityColor() returns white (same as index 1):
:If an invalid quality index is specified, GetItemQualityColor() returns white (same as index 1):
Line 45: Line 40:
::hex = |cffffffff
::hex = |cffffffff


:Quality #7 was added in version [[Patch 3.0]] for heirloom items.
== Changes ==
:ITEM_QUALITY7_DESC is now defined as of [[Patch 3.1.1]].
* Quality 7 was added in version [[Patch 3.0]] for heirloom items
:Quality #8/ITEM_QUALITY8_DESC (<span style="color: #00ccff">aqua cyan</span>) added in [[Patch 6.1.2]] for {{item|icon=|WoW Token}}.
* ITEM_QUALITY7_DESC is now defined as of [[Patch 3.1.1]]
:Quality #7/ITEM_QUALITY7_DESC changed to <span style="color: #00ccff">aqua cyan</span> as of [[Patch 7.0.3]].<ref name="wowheadLegionHeirlooms">{{ref web|work=Legion [[Wowhead]]|url=http://legion.wowhead.com/items/quality:7|title=Items (Heirloom only)|accessdate=30-Jun-2016}}</ref>{{fact}}
* [[Patch 6.1.2]] introduced quality 8, WoW Token.
 
* As of [[Patch 7.0.3]], purportedly the Heirloom color has changed from <span style="color: #e6cc80">Heirloom ffe6cc80</span> to <span style="color: #00ccff">Heirloom ff00ccff</span>. As of current released trial version [[Patch 6.2.4]] on this 2nd day of July, 2016, the value is still ffe6cc80.
== References ==
{{Reflist}}


== See also ==
== See also ==
* [[API ITEM_QUALITY_COLORS]]
* [[API ITEM_QUALITY_COLORS]]
* [[API TYPE Quality]]
* [[API TYPE Quality]]

Revision as of 20:34, 2 July 2016

WoW API < GetItemQualityColor

Returns RGB color codes for an item quality.

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

Arguments

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

Returns

  • r (number) - The Red component of the color (0 to 1, inclusive).
  • g (number) - The Green component of the color (0 to 1, inclusive).
  • b (number) - The Blue component of the color (0 to 1, inclusive).
  • hex (string) - The 4 character hex UI escape sequence for this color

Example

for i = 0, 8 do
  local r, g, b, hex = GetItemQualityColor(i)
  print(i, hex, _G["ITEM_QUALITY" .. i .. "_DESC"], hex:sub(5))
end

Result

Will print all qualities, in their individual colors (example result from version 6.2.4).
0 Poor ff9d9d9d
1 Common ffffffff
2 Uncommon ff1eff00
3 Rare ff0070dd
4 Epic ffa335ee
5 Legendary ffff8000
6 Artifact ffe6cc80
7 Heirloom ffe6cc80
8 WoW Token ff00ccff

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

Changes

  • Quality 7 was added in version Patch 3.0 for heirloom items
  • ITEM_QUALITY7_DESC is now defined as of Patch 3.1.1
  • Patch 6.1.2 introduced quality 8, WoW Token.
  • As of Patch 7.0.3, purportedly the Heirloom color has changed from Heirloom ffe6cc80 to Heirloom ff00ccff. As of current released trial version Patch 6.2.4 on this 2nd day of July, 2016, the value is still ffe6cc80.

See also