From 26622bb70a8c886f06dc34c49e132bfeb5e1af69 Mon Sep 17 00:00:00 2001 From: sourtaste000 Date: Sun, 22 May 2022 19:35:57 -0700 Subject: [PATCH 1/2] hsb coloring for rainbow, closes #311 --- .../lambda/client/gui/hudgui/elements/client/ModuleList.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt index daa261e88..e7ad5aeb3 100644 --- a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt +++ b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt @@ -36,6 +36,8 @@ internal object ModuleList : HudElement( private val indexedHue by setting("Indexed Hue", 0.5f, 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) + 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 }) @Suppress("UNUSED") private enum class SortingMode( @@ -127,7 +129,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) From 8e15f5b535aabdc8956081bbcd4ca34617761025 Mon Sep 17 00:00:00 2001 From: sourtaste000 Date: Sun, 22 May 2022 20:15:19 -0700 Subject: [PATCH 2/2] group settings, remove unused val --- .../lambda/client/gui/hudgui/elements/client/ModuleList.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt index e7ad5aeb3..0f30254e1 100644 --- a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt +++ b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt @@ -34,10 +34,10 @@ 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 primary by setting("Primary Color", ColorHolder(155, 144, 255), false) - private val secondary by setting("Secondary Color", ColorHolder(255, 255, 255), false) 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) @Suppress("UNUSED") private enum class SortingMode( @@ -105,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