function tdRange_GetColor(id)
	if IsActionInRange(id) == 0 then
		return tCC.Color.Range.r, tCC.Color.Range.g, tCC.Color.Range.b, 1
	else	
		local isUsable, notEnoughMana= IsUsableAction(id);
		if isUsable then
			return 1.0, 1.0, 1.0, 2
		elseif notEnoughMana then
			return tCC.Color.Mana.r, tCC.Color.Mana.g, tCC.Color.Mana.b, 3
		else
			return tCC.Color.Usable.r, tCC.Color.Usable.g, tCC.Color.Usable.b, 4
		end
	end
end

function ActionButton_UpdateUsable()
	local r, g, b, index = tdRange_GetColor(ActionButton_GetPagedID(this))
	if not (this.index and this.index == index) then
		this.index = index
		getglobal(this:GetName().."Icon"):SetVertexColor(r, g, b);
	end
end

old_ActionButton_OnUpdate = ActionButton_OnUpdate
function ActionButton_OnUpdate(elapsed)
	if ( this.rangeTimer and this.rangeTimer <= elapsed ) then
		ActionButton_UpdateUsable();
	end
	old_ActionButton_OnUpdate(elapsed)
end