1. #1

    Skada background class colour (.lua)

    Hi!

    I'm trying to change the background colour of skada bars to be class colour, but I can't get it to work.

    Here are the current functions for the bgcolour as well as the normal class colour (not background), if that helps.

    Code:
    			bgcolor = {
    				type="color",
    				name=L["Background color"],
    				desc=L["Choose the background color of the bars."],
    				hasAlpha=true,
    				get=function(i) return db.barbgcolor.r, db.barbgcolor.g, db.barbgcolor.b, db.barbgcolor.a end,
    				set=function(i, r,g,b,a) db.barbgcolor = {["r"] = r, ["g"] = g, ["b"] = b, ["a"] = a}; Skada:ApplySettings() end,
    				order=22,
    			},
    
    			classcolorbars = {
    			        type="toggle",
    			        name=L["Class color bars"],
    			        desc=L["When possible, bars will be colored according to player class."],
    			        order=30,
    			        get=function() return db.classcolorbars end,
    			        set=function()
    			        		db.classcolorbars = not db.classcolorbars
    		         			Skada:ApplySettings()
    			        	end,
    			},
    Either that or if there's a way to change the way the bars in skada show their length according to the percentage of damage done. I just want to use the bars as a background, not tracking the amount of damage someone has done. Though I can't seem to locate that part so I think the first step is easier

    Thanks!

  2. #2
    If you didn't found the answer and this is a 'must have', you may try Details! Damage Meter, it has the desired config at /details options -> Bars: Settings -> Bar Background.

    Btw, your mage auras are awesome.

  3. #3
    The code you brought is for Skada's configuration UI in Interface Settings.
    It's just used to change setting value, don't modify bar's appearance directly.

    I guess it's on BarDisplay.lua line 392:
    Code:
    	if data.color then
    		-- Explicit color from dataset.
    		bar:SetColorAt(0, data.color.r, data.color.g, data.color.b, data.color.a or 1)
    	elseif data.class and win.db.classcolorbars then
    		-- Class color.
    		local color = Skada.classcolors[data.class]
    		if color then
    			bar:SetColorAt(0, color.r, color.g, color.b, color.a or 1)
    		end
    	else
    		-- Default color.
    		local color = win.db.barcolor
    		bar:SetColorAt(0, color.r, color.g, color.b, color.a or 1)
    	end
    
    ...
    
    	-- Background texture color.
    	if data.backgroundcolor then
    		bar.bgtexture:SetVertexColor(data.backgroundcolor.r, data.backgroundcolor.g, data.backgroundcolor.b, data.backgroundcolor.a or 1)
    	end
    I would insert

    Code:
    bar.bgtexture:SetVertexColor(color.r * .4, color.g * .4, color.b * .4, data.backgroundcolor.a or 1)
    beneath line 399, then disable bg coloring code on line 447~449

  4. #4
    Thanks for the help ekardnah, sadly that just removes the bar all together, leaving only the background bar in it's default state. I appreciate your effort, especially since I gave the wrong functions to work with >.< But if Tercio is right I might just as well try out Details! instead. Cheers to both of you!

  5. #5
    Set barbackground alpha in the options to 0.
    Add in bardisplay.lua after line 346:
    Code:
    if not bar.bg then
    	local frame = CreateFrame("Frame", nil, bar)
    	frame:ClearAllPoints()
    	frame:SetPoint("TOPLEFT", bar, "TOPLEFT", -1, 1)
    	frame:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", 1, -1)
    	frame:SetBackdrop({
    		edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1,
    		bgFile = "Interface\\ChatFrame\\ChatFrameBackground"})
    	frame:SetFrameLevel(bar:GetFrameLevel())
    	frame:SetBackdropColor(0, 0, 0, .4)
    	frame:SetBackdropBorderColor(0, 0, 0)
    	bar.bg = frame
    end
    
    if Skada.classcolors[data.class] then
    	local color = Skada.classcolors[data.class]
    	bar.bg:SetBackdropColor(color.r, color.g, color.b, .4)
    else
    	bar.bg:SetBackdropColor(0, 0, 0, .4)
    end
    This creates new frames anchored to the bars. I use the first part for years now without problems.
    The coloring part is just for you
    Let me know how it works.

  6. #6
    Well I'll be damned. That did indeed work. I just had to change the opacity and file path to my liking and it works perfectly now.
    You really didn't have to, but thanks a lot for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •