Returns a color indicating hostility and related status of a unit. This color is used in various places in the default UI, such as the background behind a unit's name in the target and focus frames. For NPCs, the color reflects hostility and reputation, ranging from red (hostile) to orange or yellow (unfriendly or neutral) to green (friendly). When the unit is a player, a blue color is used unless the player is active for PvP, in which case the color may be red (he can attack you and you can attack him), yellow (you can attack him but he can't attack you) or green (ally). Color component values are floating point numbers between 0 and 1.


See also Unit functions.

Signature:

red, green, blue, alpha = UnitSelectionColor("unit") or UnitSelectionColor("name")

Arguments:

  • unit - A unit to query (string, unitID)
  • name - The name of a unit to query; only valid for player, pet, and party/raid members (string)

Returns:

  • red - The red component of the color. (number)
  • green - The green component of the color. (number)
  • blue - The blue component of the color. (number)
  • alpha - The alpha (opacity) component of the color. (number)