summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2024-08-26 20:11:32 +1000
committerGitHub <noreply@github.com>2024-08-26 12:11:32 +0200
commit78e5046355d1047e1988b19eaadf155caae159f1 (patch)
tree61476fed76135a763cd21ce87d46d276f753ce07 /src/main/java/at/hannibal2/skyhanni/utils
parentf9f271831ba80631e73d5f5c2e44c297552af9cc (diff)
downloadskyhanni-78e5046355d1047e1988b19eaadf155caae159f1.tar.gz
skyhanni-78e5046355d1047e1988b19eaadf155caae159f1.tar.bz2
skyhanni-78e5046355d1047e1988b19eaadf155caae159f1.zip
Feature: Made dye hex code show actual colour (#2321)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
index b2057d339..7b941aebe 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt
@@ -37,4 +37,6 @@ object ColorUtils {
fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff)
fun Color.addAlpha(alpha: Int): Color = Color(red, green, blue, alpha)
+
+ fun getColorFromHex(hex: String): Int = runCatching { Color(Integer.decode(hex)) }.getOrNull()?.rgb ?: 0
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
index 4549e2be2..8fa41978e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
@@ -63,5 +63,7 @@ enum class ItemCategory {
stack?.getItemCategoryOrNull()?.let { this.contains(it) } ?: false
val miningTools = listOf(PICKAXE, DRILL, GAUNTLET)
+
+ val armor = setOf(HELMET, CHESTPLATE, LEGGINGS, BOOTS)
}
}