Skip to content

Commit

Permalink
HSB coloring for ClickGUI rainbow mode, closes #311 (#316)
Browse files Browse the repository at this point in the history
* hsb coloring for rainbow, closes #311

* group settings, remove unused val
  • Loading branch information
not-ivy authored May 23, 2022
1 parent 1142bd0 commit e15436b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ internal object ModuleList : HudElement(
private val rainbow by setting("Rainbow", true)
private val rainbowLength by setting("Rainbow Length", 10.0f, 1.0f..20.0f, 0.5f, { rainbow })
private val indexedHue by setting("Indexed Hue", 0.5f, 0.0f..1.0f, 0.05f, { rainbow })
private val saturation by setting("Saturation", 1.0f, 0.0f..1.0f, 0.05f, { rainbow })
private val brightness by setting("Brightness", 1.0f, 0.0f..1.0f, 0.05f, { rainbow })
private val primary by setting("Primary Color", ColorHolder(155, 144, 255), false)
private val secondary by setting("Secondary Color", ColorHolder(255, 255, 255), false)

Expand Down Expand Up @@ -103,7 +105,6 @@ internal object ModuleList : HudElement(
}

private fun drawModuleList() {
val primaryHsb = Color.RGBtoHSB(primary.r, primary.g, primary.b, null)
val lengthMs = rainbowLength * 1000.0f
val timedHue = System.currentTimeMillis() % lengthMs.toLong() / lengthMs

Expand All @@ -127,7 +128,7 @@ internal object ModuleList : HudElement(

if (rainbow) {
val hue = timedHue + indexedHue * 0.05f * index++
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, primaryHsb[1], primaryHsb[2]))
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, saturation, brightness))
module.newTextLine(color).drawLine(progress, true, HAlign.LEFT, FontRenderAdapter.useCustomFont)
} else {
textLine.drawLine(progress, true, HAlign.LEFT, FontRenderAdapter.useCustomFont)
Expand Down

0 comments on commit e15436b

Please sign in to comment.