Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:LabelSetTextColor

From RoR Wiki

UI Lua API · Label functions
Version: WAR 1.4.8

Sets the text colour of a Label.

LabelSetTextColor(labelName, r, g, b)

Arguments

labelName
string – Name of a Label window.
r, g, b
number – Red, green and blue on a 0–255 scale.

Returns

Nothing.

Details

  • Each component is converted to a whole number by dropping the fractional part, then divided by 255.
  • There is no alpha argument. The text's alpha follows the label's own opacity.
  • If the colour and alpha are unchanged, nothing happens.
  • For windows with state tracking enabled, the client writes the new colour on a 0–1 scale to labelName.STATE.TEXTCOLOR_R, TEXTCOLOR_G and TEXTCOLOR_B. Note that the Lua wrapper of LabelGetTextColor reads different keys (LABEL_TEXTCOLOR_R/G/B).

Errors

  • Error in function call 'LabelSetTextColor': Window %s does not exist
  • Error in function call 'LabelSetTextColor': Window %s is not a Label

Example

From easystem_windowutils/source/label.lua:

LabelSetTextColor (self:GetName (), r, g, b)

Greying out a filter label together with its button, from ea_interactionwindow/source/interactionwindowlibrarian.lua. ENABLED_FILTER_COLOR was read earlier with LabelGetTextColor:

if isFilterable then
    color = EA_Window_InteractionLibrarianStore.ENABLED_FILTER_COLOR
else
    color = EA_Window_InteractionLibrarianStore.DISABLED_FILTER_COLOR
end

ButtonSetDisabledFlag( "EA_Window_InteractionLibrarianStoreFilterByUsableButton", not isFilterable )

LabelSetTextColor( "EA_Window_InteractionLibrarianStoreFilterByUsableLabel", color.r, color.g, color.b )

See also