Skip to content

Commit

Permalink
blend to blendRGB
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 committed Jan 17, 2024
1 parent 381130a commit e17aeab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ object ColorUtils {

fun getAlpha(colour: Int) = colour shr 24 and 0xFF

fun blend(start: Color, end: Color, percent: Double) = Color(
(start.getRed() * (1 - percent) + end.getRed() * percent).toInt(),
(start.getGreen() * (1 - percent) + end.getGreen() * percent).toInt(),
(start.getBlue() * (1 - percent) + end.getBlue() * percent).toInt()
fun blendRGB(start: Color, end: Color, percent: Double) = Color(
(start.red * (1 - percent) + end.red * percent).toInt(),
(start.green * (1 - percent) + end.green * percent).toInt(),
(start.blue * (1 - percent) + end.blue * percent).toInt()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ interface Renderable {
override val verticalAlign = verticalAlign

val progress = (1.0 + percent * (width - 2.0)).toInt()
val color = ColorUtils.blend(startColor, endColor, percent)
val color = ColorUtils.blendRGB(startColor, endColor, percent)

override fun render(posX: Int, posY: Int) {
Gui.drawRect(0, 0, width, height, 0xFF43464B.toInt())
Expand Down

0 comments on commit e17aeab

Please sign in to comment.