package info.u_team.u_team_core.gui.elements;

import org.lwjgl.opengl.GL11;

import com.mojang.blaze3d.systems.RenderSystem;

import info.u_team.u_team_core.util.RGBA;

public class ActiveButton extends UButton {
	
	protected boolean active;
	
	protected RGBA activeColor;
	
	public ActiveButton(int x, int y, int width, int height, String displayString, int activeColor) {
		this(x, y, width, height, displayString, activeColor, EMTPY_PRESSABLE);
	}
	
	public ActiveButton(int x, int y, int width, int height, String displayString, int activeColor, IPressable pressable) {
		super(x, y, width, height, displayString, pressable);
		this.activeColor = new RGBA(activeColor);
	}
	
	public RGBA getActiveColorRGBA() {
		return activeColor;
	}
	
	public void setActiveColorRGBA(RGBA activeColor) {
		this.activeColor = activeColor;
	}
	
	public boolean isActive() {
		return active;
	}
	
	public void setActive(boolean active) {
		this.active = active;
	}
	
	@Override
	public void renderButton(int mouseX, int mouseY, float partial) {
		RenderSystem.color4f(1, 1, 1, 1);
		if (active) {
			activeColor.glColor();
		}
		super.renderButton(mouseX, mouseY, partial);
		GL11.glColor4f(1, 1, 1, 1);
	}
}

package info.u_team.u_team_core.gui.elements;

import org.lwjgl.opengl.GL11;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;

import info.u_team.u_team_core.util.RGBA;
import net.minecraft.util.text.ITextComponent;

public class ActiveButton extends UButton {
	
	protected boolean active;
	
	protected RGBA activeColor;
	
	public ActiveButton(int x, int y, int width, int height, ITextComponent display, int activeColor) {
		this(x, y, width, height, display, activeColor, EMTPY_PRESSABLE);
	}
	
	public ActiveButton(int x, int y, int width, int height, ITextComponent display, int activeColor, IPressable pressable) {
		super(x, y, width, height, display, pressable);
		this.activeColor = new RGBA(activeColor);
	}
	
	public RGBA getActiveColorRGBA() {
		return activeColor;
	}
	
	public void setActiveColorRGBA(RGBA activeColor) {
		this.activeColor = activeColor;
	}
	
	public boolean isActive() {
		return active;
	}
	
	public void setActive(boolean active) {
		this.active = active;
	}
	
	@Override
	public void func_230431_b_(MatrixStack matrixStack, int mouseX, int mouseY, float partial) {
		RenderSystem.color4f(1, 1, 1, 1);
		if (active) {
			activeColor.glColor();
		}
		super.func_230431_b_(matrixStack, mouseX, mouseY, partial);
		GL11.glColor4f(1, 1, 1, 1);
	}
}

Update active button