Custom colors #17


  • Fixed
  • Enhancment
Closed
Assigned to _ForgeUser117147
  • Axodious created this issue Jun 24, 2009

    Currently I am only able to color the health bars by using the "Class Color" status. In Grid 1 (which I'm currently using) I have them set to a custom color. Would there be any way to add this functionality back, if not is there a way to manually set it in the LUA?

  • Axodious added the tags New Enhancment Jun 24, 2009
  • _ForgeUser1990418 posted a comment Jan 5, 2010

    I had this problem too. The simplest solution in my mind is that the health status should have a color associated with it. Then all you need do is associate the healthbar-color indicator with the health status and you're done.

    Works Great for me!

    Here's the lua diff:

    *** Grid2\modules\StatusHealth.lua 2010-01-05 15:37:41.000000000 -0000
    --- Grid2\modules\StatusHealth.lua 2009-09-13 01:04:14.000000000 -0000
    ***************
    *** 49,61 ****
      end
      
      
      
      Health.defaultDB = {
          profile = {
    -         color1 = { r = 0, g = 1, b = 0, a = 1 },
              deadAsFullHealth = nil,
          }
      }
      
      function Health:OnEnable()
          EnableHealthFrame(true)
    --- 49,60 ----
    ***************
    *** 77,94 ****
      end
      
      function Health:GetText(unit)
          return Grid2:GetShortNumber(UnitHealth(unit))
      end
      
    ! function Health:GetColor(unit)
    !     local color = self.db.profile.color1
    !     return color.r, color.g, color.b, color.a
    ! end
    !
    ! Grid2:RegisterStatus(Health, { "percent", "text", "color" })
      
      
      
      LowHealth.defaultDB = {
          profile = {
              threshold = 0.4,
    --- 76,88 ----
      end
      
      function Health:GetText(unit)
          return Grid2:GetShortNumber(UnitHealth(unit))
      end
      
    ! Grid2:RegisterStatus(Health, { "percent", "text" })
      
      
      
      LowHealth.defaultDB = {
          profile = {
              threshold = 0.4,
    *** Grid2Options\GridStatuses.lua 2010-01-05 15:49:33.000000000 -0000
    --- Grid2Options\GridStatuses.lua 2009-09-13 01:04:14.000000000 -0000
    ***************
    *** 622,648 ****
              if (status) then
                  options = Grid2Options:MakeStatusStandardDebuffOptions(status)
                  Grid2Options:AddElementSubType("status", "debuff", status, options)
              end
          end
      
    !     status = Grid2.statuses.health
    !     if (status) then
    !         options = Grid2Options:MakeStatusColorOption(status)
    !         options.deadAsFullHealth = {
    !                 type = "toggle",
    !                 name = L["Show dead as having Full Health"],
    !                 get = function ()
    !                     return Grid2.statuses.health.db.profile.deadAsFullHealth
    !                 end,
    !                 set = function (_, v)
    !                     Grid2.statuses.health.db.profile.deadAsFullHealth = v
    !                 end,
    !             }
    !         Grid2Options:AddElement("status", status, options )
    !     end
      
          status = Grid2.statuses.range
          Grid2Options:AddElement("status", status, {
              default = {
                  type = "range",
                  order = 10,
    --- 622,645 ----
              if (status) then
                  options = Grid2Options:MakeStatusStandardDebuffOptions(status)
                  Grid2Options:AddElementSubType("status", "debuff", status, options)
              end
          end
      
    !     Grid2Options:AddElement("status", Grid2.statuses.health {
    !         deadAsFullHealth = {
    !             type = "toggle",
    !             name = L["Show dead as having Full Health"],
    !             get = function ()
    !                 return Grid2.statuses.health.db.profile.deadAsFullHealth
    !             end,
    !             set = function (_, v)
    !                 Grid2.statuses.health.db.profile.deadAsFullHealth = v
    !             end,
    !         },
    !     })
      
          status = Grid2.statuses.range
          Grid2Options:AddElement("status", status, {
              default = {
                  type = "range",
                  order = 10,

  • _ForgeUser117147 posted a comment Jan 5, 2010

    Gaff3, could you please post this diff in unified format (diff -u) ? between WikiCreole "code" tags ?

    Thanks

  • _ForgeUser1990418 posted a comment Jan 5, 2010

    Here you go:

    Left base folder: k:\World of Warcraft\xinterface
    Right base folder: k:\World of Warcraft\Interface\AddOns
    --- Grid2\modules\StatusHealth.lua	2010-01-05 11:03:12.000000000 -0000
    +++ Grid2\modules\StatusHealth.lua	2010-01-05 15:37:41.000000000 -0000
    @@ -49,12 +49,13 @@
     end
     
     
     
     Health.defaultDB = {
     	profile = {
    +		color1 = { r = 0, g = 1, b = 0, a = 1 },
     		deadAsFullHealth = nil,
     	}
     }
     
     function Health:OnEnable()
     	EnableHealthFrame(true)
    @@ -76,13 +77,18 @@
     end
     
     function Health:GetText(unit)
     	return Grid2:GetShortNumber(UnitHealth(unit))
     end
     
    -Grid2:RegisterStatus(Health, { "percent", "text" })
    +function Health:GetColor(unit)
    +	local color = self.db.profile.color1
    +	return color.r, color.g, color.b, color.a
    +end
    +
    +Grid2:RegisterStatus(Health, { "percent", "text", "color" })
     
     
     
     LowHealth.defaultDB = {
     	profile = {
     		threshold = 0.4,
    --- Grid2Options\GridStatuses.lua	2010-01-05 11:03:12.000000000 -0000
    +++ Grid2Options\GridStatuses.lua	2010-01-05 16:03:48.000000000 -0000
    @@ -681,24 +681,27 @@
     		if (status) then
     			options = Grid2Options:MakeStatusStandardDebuffOptions(status)
     			Grid2Options:AddElementSubType("status", "debuff", status, options)
     		end
     	end
     
    -	Grid2Options:AddElement("status", Grid2.statuses.health, {
    -		deadAsFullHealth = {
    -			type = "toggle",
    -			name = L["Show dead as having Full Health"],
    -			get = function ()
    -				return Grid2.statuses.health.db.profile.deadAsFullHealth
    -			end,
    -			set = function (_, v)
    -				Grid2.statuses.health.db.profile.deadAsFullHealth = v
    -			end,
    -		},
    -	})
    +	status = Grid2.statuses.health
    +	if (status) then
    +		options = Grid2Options:MakeStatusColorOption(status)
    +		options.deadAsFullHealth = {
    +				type = "toggle",
    +				name = L["Show dead as having Full Health"],
    +				get = function ()
    +					return Grid2.statuses.health.db.profile.deadAsFullHealth
    +				end,
    +				set = function (_, v)
    +					Grid2.statuses.health.db.profile.deadAsFullHealth = v
    +				end,
    +			}
    +		Grid2Options:AddElement("status", status, options )
    +	end
     
     	status = Grid2.statuses.range
     
     	local function GetAvailableRangeList()
     		local rangelist = {}
     		for r in GridRange:AvailableRangeIterator() do
    
    
  • _ForgeUser1990418 posted a comment Jan 5, 2010

    Should probably also change the default healthbar-color indicator to show class-colour then health.

  • _ForgeUser117147 posted a comment Jan 5, 2010

    Applied Gaff3's patch in r296.

    Thanks

  • _ForgeUser117147 removed a tag New Jan 5, 2010
  • _ForgeUser117147 added a tag Fixed Jan 5, 2010
  • _ForgeUser117147 closed issue Jan 5, 2010

To post a comment, please login or register a new account.