WoW:API GetItemQualityColor: Difference between revisions
Jump to navigation
Jump to search
(→Parameters: boilerplate) |
(→Result) |
||
Line 11: | Line 11: | ||
;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 [[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 == | ||
Line 22: | Line 23: | ||
: 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 3.1.1). | ||
{{Example/Begin}} | {{Example/Begin}} | ||
0 <span style="color: #9d9d9d">Poor | 0 <span style="color: #9d9d9d">Poor ff9d9d9d</span><br /> | ||
1 <span style="color: #ffffff">Common | 1 <span style="color: #ffffff">Common ffffffff</span><br /> | ||
2 <span style="color: #1eff00">Uncommon | 2 <span style="color: #1eff00">Uncommon ff1eff00</span><br /> | ||
3 <span style="color: #0070dd">Rare | 3 <span style="color: #0070dd">Rare ff0070dd</span><br /> | ||
4 <span style="color: #a335ee">Epic | 4 <span style="color: #a335ee">Epic ffa335ee</span><br /> | ||
5 <span style="color: #ff8000">Legendary | 5 <span style="color: #ff8000">Legendary ffff8000</span><br /> | ||
6 <span style="color: #e6cc80">Artifact | 6 <span style="color: #e6cc80">Artifact ffe6cc80</span><br /> | ||
7 <span style="color: #e6cc80">Heirloom | 7 <span style="color: #e6cc80">Heirloom ffe6cc80</span> | ||
{{Example/End}} | {{Example/End}} | ||
==Details== | ==Details== |
Revision as of 23:53, 9 June 2013
← 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, 7 do local r, g, b, hex = GetItemQualityColor(i); print(i, hex, getglobal("ITEM_QUALITY" .. i .. "_DESC"), string.sub(hex,5)); end
Result
- Will print all qualities, in their individual colors (example result from version 3.1.1).
Template:Example/Begin
0 Poor ff9d9d9d
1 Common ffffffff
2 Uncommon ff1eff00
3 Rare ff0070dd
4 Epic ffa335ee
5 Legendary ffff8000
6 Artifact ffe6cc80
7 Heirloom ffe6cc80
Template:Example/End
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
- Quality #7 was added in version 3.0 for heirloom items.
- ITEM_QUALITY7_DESC is now defined as of 3.1.1.