Quantcast Color space differences between StatusBar and Texture - WoWInterface
Thread Tools Display Modes
02-26-19, 09:09 PM   #1
Terenna
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 98
Color space differences between StatusBar and Texture

Hello,

I've looked fairly thoroughly, but admittedly, may have missed some key words. I've noticed that the "color space" for status bars and textures are different. That is, if one were to:

Lua Code:
  1. local f = CreateFrame('Statusbar', nil, UIParent)
  2. f:SetSize(100, 20)
  3. f:SetPoint('CENTER')
  4. f:SetTexture(some generic texture with no coloring or tinting)
  5. f:SetStatusBarColor(1, 0, 0)
  6.  
  7. local g = CreateFrame('StatusBar', nil, UIParent)
  8. g:SetSize(100, 20)
  9. g:SetPoint('CENTER', 0, - 30)
  10.  
  11. local g.texture = g:CreateTexture(nil, 'BORDER')
  12. g.texture:SetAllPoints()
  13. g.texture:SetTexture(some generic texture with no color or tinting)
  14. g.texture:SetColorTexture(1, 0, 0)
  15. g:SetStatusBarColor(g.texture)
  16.  
  17. local h = CreateFrame('Frame', nil, UIParent)
  18. h:SetSize(100, 20)
  19. h:SetPoint('CENTER', 0, -60)
  20. h.texture = h:CreateTexture(nil, 'BORDER')
  21. h.texture:SetAllPoints()
  22. h.texture:SetColorTexture(1, 0, 0)

you get three bars, and 2 colors. Directly setting StatusBarColor with 0-1 r, g, b values results in almost like a cmyk compared to rgb color space. Making a texture and setting the StatusBarColor with the texture created gets around this, as too does just using a texture and skipping StatusBars all together.

I'm not sure if this is intended what, but it's kind of a pain in the ass with oUF, as all of the bars can only utilize statusbars and require overrides to change colors properly with the statusbarcolor set to a texture and change the texture color using SetColorTexture. Has anyone else encountered this?

Last edited by Terenna : 02-26-19 at 09:55 PM.
  Reply With Quote
02-26-19, 10:17 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,134
I don't think you're seeing what you think you are seeing (or I'm missing something).

Lua Code:
  1. local f = CreateFrame('Statusbar', nil, UIParent)
  2. f:SetSize(100, 20)
  3. f:SetPoint('CENTER')
  4. f:SetMinMaxValues(0, 100)
  5. f:SetStatusBarTexture("Interface/BUTTONS/WHITE8X8")
  6. f:SetStatusBarColor(1, 0, 0)
  7. f:SetValue(50)
  8.  
  9. local g = CreateFrame('StatusBar', nil, UIParent)
  10. g:SetSize(100, 20)
  11. g:SetPoint('CENTER', 0, - 30)
  12. g:SetMinMaxValues(0, 100)
  13. g:SetValue(60)
  14. g:SetStatusBarTexture("Interface/BUTTONS/WHITE8X8")
  15. g:SetStatusBarColor(0.5, 0.5, 0)
  16.  --
  17. g.texture = g:CreateTexture(nil, 'BORDER')
  18. g.texture:SetSize(20, 20)
  19. g.texture:SetPoint("LEFT", g, "RIGHT", 10, 0)
  20. g.texture:SetTexture("Interface/BUTTONS/WHITE8X8")
  21. g.texture:SetColorTexture(0, 0, 1)
  22. g:SetStatusBarColor(g.texture)
  23.  
  24. local h = CreateFrame('Frame', nil, UIParent)
  25. h:SetSize(100, 20)
  26. h:SetPoint('CENTER', 0, -60)
  27. h.texture = h:CreateTexture(nil, 'BORDER')
  28. h.texture:SetAllPoints()
  29. h.texture:SetColorTexture(0, 1, 0)

I don't know oUF but if it lets you set a status bar colour using a texture widget maybe it is using a custom startusbar creation and not the default StatusBar widget.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-26-19 at 10:28 PM.
  Reply With Quote
02-27-19, 12:52 AM   #3
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
If you don't set your own statusbar texture via SetStatusBarTexture, oUF will do it for you. It also says so in its docs.

And according to your own code, you don't do that:
Lua Code:
  1. local f = CreateFrame('Statusbar', nil, UIParent)
  2. f:SetSize(100, 20)
  3. f:SetPoint('CENTER')
  4. -- you're using SetTexture and not SetStatusBarTexture
  5. f:SetTexture(some generic texture with no coloring or tinting)
  6. f:SetStatusBarColor(1, 0, 0)

Here's mine:
Lua Code:
  1. local f = CreateFrame('Statusbar', nil, UIParent)
  2. f:SetSize(128, 24)
  3. f:SetPoint('CENTER')
  4. f:SetMinMaxValues(0, 128)
  5. f:SetValue(48)
  6. f:SetStatusBarTexture("Interface/BUTTONS/WHITE8X8")
  7. f:SetStatusBarColor(1, 1, 0)
  8.  
  9. local g = CreateFrame('StatusBar', nil, UIParent)
  10. g:SetSize(128, 24)
  11. g:SetPoint('CENTER', 0, -24)
  12. g:SetMinMaxValues(0, 128)
  13. g:SetValue(64)
  14. g:SetStatusBarTexture("Interface/BUTTONS/WHITE8X8")
  15. g:SetStatusBarColor(0, 0, 0, 0)
  16.  
  17. g.texture = g:CreateTexture(nil, 'BORDER')
  18. g.texture:SetAllPoints(g:GetStatusBarTexture())
  19. g.texture:SetColorTexture(1, 1, 0)

__________________

Last edited by lightspark : 02-27-19 at 08:16 AM.
  Reply With Quote
02-27-19, 06:39 AM   #4
Terenna
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 98
First off, thank you both. Second, I'm sorry, I should have just actually coded it rather than dry coded it and actually taken a screenshot. I've done both:
Lua Code:
  1. local a = CreateFrame('Statusbar', nil, UIParent)
  2. a:SetSize(100, 20)
  3. a:SetPoint('CENTER', 0, -200)
  4. a:SetStatusBarTexture('Interface\\AddOns\\tMinimap\\Texture')
  5. a:SetMinMaxValues(0, 1)
  6. a:SetValue(0.5)
  7. a:SetStatusBarColor(1, 0, 0)
  8.  
  9. local b = CreateFrame('StatusBar', nil, UIParent)
  10. b:SetSize(100, 20)
  11. b:SetPoint('CENTER', 0, -230)
  12. b:SetMinMaxValues(0, 1)
  13. b:SetValue(1)
  14.  
  15. b.texture = b:CreateTexture(nil, 'BORDER')
  16. b.texture:SetAllPoints()
  17. b.texture:SetTexture('Interface\\AddOns\\tMinimap\\Texture')
  18. b.texture:SetColorTexture(1, 0, 0)
  19. b:SetStatusBarColor(g.texture)
  20.  
  21. local c = CreateFrame('Frame', nil, UIParent)
  22. c:SetSize(100, 20)
  23. c:SetPoint('CENTER', 0, -260)
  24. c.texture = c:CreateTexture(nil, 'BORDER')
  25. c.texture:SetAllPoints()
  26. c.texture:SetTexture('Interface\\AddOns\\tMinimap\\Texture')
  27. c.texture:SetColorTexture(1, 0, 0)

which generates this:

It turns out, despite it being a perfect white in photoshop (eyedrop says #FFFFFF), that texture is somehow displaying colors differently, but only when using :SetStatusBarTexture? When I use "Interface/BUTTONS/WHITE8X8" all three colors are the exact same.

I guess the question still stands then, why would a texture appear differently when using SetStatusBarTexture(direct texture file) and SetStatusBarColor vs SetStatusBarTexture(Some texture set to the direct texture file) and SetColorTexture?

Last edited by Terenna : 02-27-19 at 07:41 AM.
  Reply With Quote
02-27-19, 08:14 AM   #5
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
I believe your custom texture isn't fully opaque. Could you upload it?

On a side note.

Lua Code:
  1. b.texture:SetTexture('Interface\\AddOns\\tMinimap\\Texture')
  2. b.texture:SetColorTexture(1, 0, 0)

This doesn't do what you think it does. SetColorTexture is the same as SetTexture, but accepts RGBA instead of texture IDs or paths, it means that the only widget that actually uses your custom texture is the statusbar.

Try doing this:
Lua Code:
  1. b.texture:SetTexture('Interface\\AddOns\\tMinimap\\Texture')
  2. b.texture:SetVertexColor(1, 0, 0)
__________________

Last edited by lightspark : 02-27-19 at 08:56 AM.
  Reply With Quote
02-27-19, 09:09 AM   #6
Terenna
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 98
>mfw I spend hours trying to figure out why I'm seeing something only to find out that I'm an illiterate idiot who doesn't understand widget documentation and opacity: https://www.youtube.com/watch?v=Yg03q100E4g

PS thank you for your times, sorry it had to be used on something so stupid
  Reply With Quote
02-27-19, 09:11 AM   #7
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
Mystery solved
__________________
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Color space differences between StatusBar and Texture

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off