[android-components](../index.md) / [mozilla.components.support.ktx.android.content](index.md) / [getColorFromAttr](./get-color-from-attr.md)

# getColorFromAttr

`fun <ERROR CLASS>.getColorFromAttr(@AttrRes attr: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): <ERROR CLASS>` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt#L144)

Returns the color int corresponding to the attribute.

