Skip to content

Commit 3bb5d7d

Browse files
committed
HUD: Show time using primary and secondary colors
Before this patch the time was always shown as white. Now we show the time/date's numeric characters in the primary color and the non numeric characters in the secondary color :)
1 parent d800fbd commit 3bb5d7d

File tree

1 file changed

+11
-3
lines changed
  • src/main/kotlin/com/lambda/client/gui/hudgui/elements/misc

1 file changed

+11
-3
lines changed

src/main/kotlin/com/lambda/client/gui/hudgui/elements/misc/Time.kt

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import com.lambda.client.util.TimeUtils
77
internal object Time : LabelHud(
88
name = "Time",
99
category = Category.MISC,
10-
description = "System date and time"
10+
description = "System date and time",
11+
separator = "",
1112
) {
1213

1314
private val showDate = setting("Show Date", true)
@@ -17,8 +18,15 @@ internal object Time : LabelHud(
1718
private val timeUnit = setting("Time Unit", TimeUtils.TimeUnit.H12, { showTime.value })
1819

1920
override fun SafeClientEvent.updateText() {
20-
if (showDate.value) displayText.addLine(TimeUtils.getDate(dateFormat.value))
21-
if (showTime.value) displayText.addLine(TimeUtils.getTime(timeFormat.value, timeUnit.value))
21+
if (showDate.value) {
22+
val date = TimeUtils.getDate(dateFormat.value)
23+
date.forEach { displayText.add(it.toString(), if (it.isDigit()) primaryColor else secondaryColor) }
24+
displayText.addLine("")
25+
}
26+
if (showTime.value) {
27+
val time = TimeUtils.getTime(timeFormat.value, timeUnit.value)
28+
time.forEach { displayText.add(it.toString(), if (it.isDigit()) primaryColor else secondaryColor) }
29+
}
2230
}
2331

2432
}

0 commit comments

Comments
 (0)