aboutsummaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/src')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
index eb285ef..5d702e7 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -221,5 +221,12 @@ fun EditText.tintCursor(@ColorInt color: Int) {
} catch (e: Exception) {
e.printStackTrace()
}
+}
+fun Toolbar.tint(@ColorInt color: Int, tintTitle: Boolean = true) {
+ if (tintTitle) {
+ setTitleTextColor(color)
+ setSubtitleTextColor(color)
+ }
+ (0 until childCount).asSequence().forEach { (getChildAt(it) as? ImageButton)?.setColorFilter(color) }
} \ No newline at end of file