Class ColorRamp
java.lang.Object
privbot.ui.overlay.ColorRamp
A value-to-colour rule, so a threshold ladder is written once and reused.
Replaces the copies of ticksLeft <= 1 ? RED : ticksLeft <= 2 ? ORANGE : YELLOW and
pct <= threshold * 0.5 ? DANGER : pct <= threshold ? WARN : GOOD in the plugin overlays.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorRampAlways the same colour.of(int value) The colour for a plainvalue(a tick count, a percentage).of(int value, int max) The colour forvalueout ofmax, evaluated as a percentage;max <= 0= -1.static ColorRampof(ColorRamp.Rule rule) A ramp from any rule, e.g.static ColorRamppercentBelow(int thresholdPercent) A vital against a percentage threshold (the eat/pray thresholds plugins configure): at or below half the threshold isOverlayTheme.BAD, at or below the thresholdOverlayTheme.WARN, above itOverlayTheme.GOOD.static ColorRampticks(int urgentAt, int warnAt) A tick countdown:value <= urgentAtisOverlayTheme.BAD,<= warnAtisOverlayTheme.WARN, anything later isOverlayTheme.INFO.static ColorRampticks(int, int)with your own three colours.
-
Method Details
-
of
A ramp from any rule, e.g.v -> v > 0 ? OverlayTheme.GOOD : OverlayTheme.MUTED. -
fixed
-
ticks
A tick countdown:value <= urgentAtisOverlayTheme.BAD,<= warnAtisOverlayTheme.WARN, anything later isOverlayTheme.INFO. -
ticks
ticks(int, int)with your own three colours. -
percentBelow
A vital against a percentage threshold (the eat/pray thresholds plugins configure): at or below half the threshold isOverlayTheme.BAD, at or below the thresholdOverlayTheme.WARN, above itOverlayTheme.GOOD. Use withof(int, int); an unknown max isOverlayTheme.MUTED. -
of
The colour for a plainvalue(a tick count, a percentage). -
of
The colour forvalueout ofmax, evaluated as a percentage;max <= 0= -1.
-