WoW:API GetThreatStatusColor: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Cleanup, add details on return values for each threat level)
m (Move page script moved page API GetThreatStatusColor to API GetThreatStatusColor without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi|toc=0}}
Returns RGB color value corresponding to a threat status returned by [[API UnitThreatSituation|UnitThreatSituation]].  Added in Patch 3.0.
r, g, b = GetThreatStatusColor(statusIndex)


Returns RGB color values relating to a threat status.  New in [[Patch 3.0]].
== Parameters ==
=== Arguments ===
* status (integer) - the [[API TYPE ThreatStatus|ThreatStatus]] value to get colors for


r, g, b = GetThreatStatusColor([[API TYPE ThreatStatus|status]])
=== Returns ===
* r (number) - a value between 0 and 1 for the red content of the color
* g (number) - a value between 0 and 1 for the green content of the color
* b (number) - a value between 0 and 1 for the blue content of the color


==Arguments==
=== Result ===
:;status : integer - the [[API TYPE ThreatStatus|threat status]] value to get colors for
 
==Returns==
:;r : number - a value between 0 and 1 for the red content of the color
:;g : number - a value between 0 and 1 for the green content of the color
:;b : number - a value between 0 and 1 for the blue content of the color
 
==Example==
local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat",  "overnuking", "losing threat", "tanking securely" }
local r, g, b = GetThreatStatusColor(status)
print("You are " .. statustxts[status + 1] .. ".", r, g, b)
===Result===
Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.
Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.
  <font color="AFAFAF">You are low on threat.</font>
  <font color="AFAFAF">You are low on threat.</font>
Line 24: Line 19:
  <font color="FF0000">You are tanking securely.</font>
  <font color="FF0000">You are tanking securely.</font>


==Notes==
== Examples ==
As of [[Patch 3.0.9]], the following r, g, b values are returned for each threat level:
local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat",  "overnuking", "losing threat", "tanking securely" }
:;0 : 0.69, 0.69, 0.69
local r, g, b = GetThreatStatusColor(status)
:;1 : 1, 1, 0.47
print("You are " .. statustxts[status + 1] .. ".", r, g, b)
:;2 : 1, 0.6, 0
:;3 : 1, 0, 0
 
==See also==


[[API UnitThreatSituation]] | [[API UnitDetailedThreatSituation]]
== Notes ==
As of Patch 3.0.9, the following r, g, b values are returned for each threat level:
* 0: <span style="color: #AFAFAF">0.69, 0.69, 0.69</span>
* 1: <span style="color: #FFFF77">1, 1, 0.47</span>
* 2: <span style="color: #FF9900">1, 0.6, 0</span>
* 3: <span style="color: #FF0000">1, 0, 0</span>


== See also ==
* [[API UnitThreatSituation]]
* [[API UnitDetailedThreatSituation]]
[[Category:Interface customization]]
[[Category:Interface customization]]
[[Category:World of Warcraft API]]
[[Category:World of Warcraft API]]

Latest revision as of 04:46, 15 August 2023

WoW API < GetThreatStatusColor

Returns RGB color value corresponding to a threat status returned by UnitThreatSituation. Added in Patch 3.0.

r, g, b = GetThreatStatusColor(statusIndex)

Parameters

Arguments

Returns

  • r (number) - a value between 0 and 1 for the red content of the color
  • g (number) - a value between 0 and 1 for the green content of the color
  • b (number) - a value between 0 and 1 for the blue content of the color

Result

Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.

You are low on threat.
You are overnuking.
You are losing threat.
You are tanking securely.

Examples

local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat",  "overnuking", "losing threat", "tanking securely" }
local r, g, b = GetThreatStatusColor(status)
print("You are " .. statustxts[status + 1] .. ".", r, g, b)

Notes

As of Patch 3.0.9, the following r, g, b values are returned for each threat level:

  • 0: 0.69, 0.69, 0.69
  • 1: 1, 1, 0.47
  • 2: 1, 0.6, 0
  • 3: 1, 0, 0

See also