Inventory Grid Plugin: Add color configuration
This commit is contained in:
@@ -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;
|
||||||
@@ -35,7 +37,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()
|
||||||
{
|
{
|
||||||
@@ -45,7 +48,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()
|
||||||
{
|
{
|
||||||
@@ -55,7 +59,8 @@ 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()
|
||||||
{
|
{
|
||||||
@@ -65,11 +70,36 @@ public interface InventoryGridConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "dragDelay",
|
keyName = "dragDelay",
|
||||||
name = "Drag Delay",
|
name = "Drag Delay",
|
||||||
description = "Time in ms to wait after item press before showing grid"
|
description = "Time in ms to wait after item press before showing grid",
|
||||||
|
position = 4
|
||||||
)
|
)
|
||||||
@Range(min = 100)
|
@Range(min = 100)
|
||||||
default int dragDelay()
|
default int dragDelay()
|
||||||
{
|
{
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Alpha
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "gridColor",
|
||||||
|
name = "Grid color",
|
||||||
|
description = "The color of the grid",
|
||||||
|
position = 5
|
||||||
|
)
|
||||||
|
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 = 6
|
||||||
|
)
|
||||||
|
default Color highlightColor()
|
||||||
|
{
|
||||||
|
return new Color(0, 255, 0, 45);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user