inventory grid: add color config

This commit is contained in:
Jeremy Plsek
2019-06-04 13:49:28 +02:00
parent 8806bba274
commit 67bfbf082b
2 changed files with 34 additions and 9 deletions

View File

@@ -24,6 +24,8 @@
*/ */
package net.runelite.client.plugins.inventorygrid; package net.runelite.client.plugins.inventorygrid;
import java.awt.Color;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
@@ -34,7 +36,8 @@ public interface InventoryGridConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "showItem", keyName = "showItem",
name = "Show item", name = "Show item",
description = "Show a preview of the item in the new slot" description = "Show a preview of the item in the new slot",
position = 1
) )
default boolean showItem() default boolean showItem()
{ {
@@ -44,7 +47,8 @@ public interface InventoryGridConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "showGrid", keyName = "showGrid",
name = "Show grid", name = "Show grid",
description = "Show a grid on the inventory while dragging" description = "Show a grid on the inventory while dragging",
position = 2
) )
default boolean showGrid() default boolean showGrid()
{ {
@@ -54,10 +58,35 @@ public interface InventoryGridConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "showHighlight", keyName = "showHighlight",
name = "Highlight background", name = "Highlight background",
description = "Show a green background highlight on the new slot" description = "Show a background highlight on the new slot",
position = 3
) )
default boolean showHighlight() default boolean showHighlight()
{ {
return true; return true;
} }
@Alpha
@ConfigItem(
keyName = "gridColor",
name = "Grid color",
description = "The color of the grid",
position = 4
)
default Color gridColor()
{
return new Color(255, 255, 255, 45);
}
@Alpha
@ConfigItem(
keyName = "highlightColor",
name = "Highlight color",
description = "The color of the new inventory slot highlight",
position = 5
)
default Color highlightColor()
{
return new Color(0, 255, 0, 45);
}
} }

View File

@@ -27,7 +27,6 @@ package net.runelite.client.plugins.inventorygrid;
import com.google.inject.Inject; import com.google.inject.Inject;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
@@ -47,9 +46,6 @@ class InventoryGridOverlay extends Overlay
private static final int INVENTORY_SIZE = 28; private static final int INVENTORY_SIZE = 28;
private static final int DRAG_DELAY = 5; private static final int DRAG_DELAY = 5;
private static final Color HIGHLIGHT = new Color(0, 255, 0, 45);
private static final Color GRID = new Color(255, 255, 255, 45);
private final InventoryGridConfig config; private final InventoryGridConfig config;
private final Client client; private final Client client;
private final ItemManager itemManager; private final ItemManager itemManager;
@@ -101,12 +97,12 @@ class InventoryGridOverlay extends Overlay
if (config.showHighlight() && inBounds) if (config.showHighlight() && inBounds)
{ {
graphics.setColor(HIGHLIGHT); graphics.setColor(config.highlightColor());
graphics.fill(bounds); graphics.fill(bounds);
} }
else if (config.showGrid()) else if (config.showGrid())
{ {
graphics.setColor(GRID); graphics.setColor(config.gridColor());
graphics.fill(bounds); graphics.fill(bounds);
} }
} }