aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
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)
}
}