Skip to content

Commit

Permalink
Settings for custom progress bar colors
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume009 committed Apr 2, 2023
1 parent e723db0 commit 08c12ce
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ build
.classpath
nbactions.xml
nb-configuration.xml
nbproject/
nbproject/
*.class
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ Displays an indicator showing how much progress you've made on your current acti
- Added interruption when pest control portals drop.
- Updated for RuneLite version 1.8.30.
- `1.05`
- Add double ammo mould support
- Add double ammo mould support
- Add settings for customizable colors for progress bar
- Updated for RuneLite version 1.9.13.3
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void drawText(Graphics2D g, Rectangle bounds, Color color, Alignment alig
g.drawString(text, fX, fY);
}

public void drawProgressBar(Graphics2D g, Rectangle bounds, Color borderColor, long min, long max, long value)
public void drawProgressBar(Graphics2D g, Rectangle bounds, Color borderColor, Color progressLeftColor, Color progressDoneColor, long min, long max, long value)
{
double progress = ((double) value - min) / ((double) max - min);
progress = Math.min(1.0, progress);
Expand All @@ -96,9 +96,9 @@ public void drawProgressBar(Graphics2D g, Rectangle bounds, Color borderColor, l
Rectangle progressLeft = new Rectangle(bounds);
progressLeft.x += progressDone.width;
progressLeft.width -= progressDone.width;
g.setColor(new Color(255, 52, 52, 100));
g.setColor(progressLeftColor);
g.fill(progressLeft);
g.setColor(new Color(0, 255, 52, 100));
g.setColor(progressDoneColor);
g.fill(progressDone);
g.setColor(borderColor);
g.draw(bounds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
import java.awt.Color;

@ConfigGroup("actionprogress")
@SuppressWarnings("SameReturnValue")
Expand Down Expand Up @@ -102,6 +103,28 @@ default boolean ignoreSingleActions()
return true;
}

@ConfigItem(
name = "Progress left color",
keyName = "progress-left-color",
description = "Color to be used to display the remaining actions on the progress bar",
position = 3
)
default Color progressLeftColor()
{
return new Color(255, 52, 52, 100);
}

@ConfigItem(
name = "Progress done color",
keyName = "progress-done-color",
description = "Color to be used to display the completed actions on the progress bar",
position = 3
)
default Color progressDoneColor()
{
return new Color(0, 255, 52, 100);
}

@ConfigItem(
name = "Cooking",
keyName = "cooking.cooking",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ private Dimension renderInfobox(
int width = INSET + ICON_SIZE + PAD + PROGRESS_WIDTH + INSET;
int height = INSET + ICON_SIZE + PAD + fm.getHeight() + INSET;
Color border = Rendering.outsideStrokeColor(this.runeLiteConfig.overlayBackgroundColor());
Color progressDoneColor = this.config.progressDoneColor();
Color progressLeftColor = this.config.progressLeftColor();
g.setColor(this.runeLiteConfig.overlayBackgroundColor());
g.fillRect(0, 0, width, height);
g.setColor(border);
Expand All @@ -90,7 +92,7 @@ private Dimension renderInfobox(
Alignment.CENTER, header
);
Rendering.drawProgressBar(g, new Rectangle(right.x, (int) right.getCenterY(), right.width, (right.height / 2)),
border, min, max, value
border, progressLeftColor, progressDoneColor, min, max, value
);
return new Dimension(width, height);
}
Expand Down

0 comments on commit 08c12ce

Please sign in to comment.