Thread: Setting Colors
View Single Post
11/23/20, 08:16 PM   #1
NyghtStar
Join Date: Nov 2020
Posts: 2
Setting Colors

I've just started looking into writing addons and came across an issue that perplexed me and I am hoping one of you can shed some light into the issue.

I simply want to set the color of a status bar to a mint green shade
rgb: 200,255,210 or hex: #c8ffd2

In the XML I Have:
Code:
	
<StatusBar name="$(parent)_StatusBar" layer="0" level="1">
    <Dimensions x="100" y="10" />
    <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="0" offsetY="0"/>
    <Limits min="0" max="100" />
</StatusBar>
If I use:
Code:
	
<StatusBar name="$(parent)_StatusBar" layer="0" level="1" color="c8ffd2" alpha="1">
    <Dimensions x="100" y="10" />
    <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="0" offsetY="0"/>
    <Limits min="0" max="100" />
</StatusBar>
it works just fine. BUT....

in the LUA I want to change the status bar color depending on events.
when I try to set the color back to the mint green, it shows as all white

Code:
Nyght_Status_Window_StatusBar:SetColor(200, 255, 210, 1.0)
I have tried setting it to all red
Code:
Nyght_Status_Window_StatusBar:SetColor(255, 0, 0, 1.0)
and it works, same for all green or all blue

I even set it to yellow with no problem
Code:
Nyght_Status_Window_StatusBar:SetColor(255, 255, 0, 1.0)
From this state though, I change the third value from anything but 0, I get all white, even using just a 1
Code:
Nyght_Status_Window_StatusBar:SetColor(255, 255, 1, 1.0)

I did notice, that if I used a lower alpha value in the XML
Code:
	
<StatusBar name="$(parent)_StatusBar" layer="0" level="1" color="c8ffd2" alpha="0.5">...
That the alpha value of the LUA would only be based off that 0.5
(IE.
Code:
Nyght_Status_Window_StatusBar:SetColor(255, 255, 0, 1.0)
shows yellow half transparent)

Is there something similar I am missing with the color, or why the blue color isn't working as I would expect?

Thanks for any insight to this issue.

Nyght
  Reply With Quote