WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Color space differences between StatusBar and Texture (https://www.wowinterface.com/forums/showthread.php?t=57034)

Terenna 02-26-19 09:09 PM

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?

Fizzlemizz 02-26-19 10:17 PM

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.

lightspark 02-27-19 12:52 AM

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)


Terenna 02-27-19 06:39 AM

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?

lightspark 02-27-19 08:14 AM

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)

Terenna 02-27-19 09:09 AM

>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

lightspark 02-27-19 09:11 AM

Mystery solved :D


All times are GMT -6. The time now is 03:49 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI