Skip to content

Instantly share code, notes, and snippets.

@NinoDLC
Created December 15, 2021 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NinoDLC/1883ec1422386cb6e7be2ce57c5574ee to your computer and use it in GitHub Desktop.
Save NinoDLC/1883ec1422386cb6e7be2ce57c5574ee to your computer and use it in GitHub Desktop.
@ColorRes
fun getTypeColorRes(type: String?): Int? = when (type) {
"normal" -> R.color.type_normal
"fire" -> R.color.type_fire
"water" -> R.color.type_water
"electric" -> R.color.type_electric
"grass" -> R.color.type_grass
"ice" -> R.color.type_ice
"fighting" -> R.color.type_fighting
"poison" -> R.color.type_poison
"ground" -> R.color.type_ground
"flying" -> R.color.type_flying
"psychic" -> R.color.type_psychic
"bug" -> R.color.type_bug
"rock" -> R.color.type_rock
"ghost" -> R.color.type_ghost
"dragon" -> R.color.type_dragon
"dark" -> R.color.type_dark
"steel" -> R.color.type_steel
"fairy" -> R.color.type_fairy
else -> null
}
<color name="type_normal">#A8A77A</color>
<color name="type_fire">#EE8130</color>
<color name="type_water">#6390F0</color>
<color name="type_electric">#F7D02C</color>
<color name="type_grass">#7AC74C</color>
<color name="type_ice">#96D9D6</color>
<color name="type_fighting">#C22E28</color>
<color name="type_poison">#A33EA1</color>
<color name="type_ground">#E2BF65</color>
<color name="type_flying">#A98FF3</color>
<color name="type_psychic">#F95587</color>
<color name="type_bug">#A6B91A</color>
<color name="type_rock">#B6A136</color>
<color name="type_ghost">#735797</color>
<color name="type_dragon">#6F35FC</color>
<color name="type_dark">#705746</color>
<color name="type_steel">#B7B7CE</color>
<color name="type_fairy">#D685AD</color>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment