ColorUtils

object ColorUtils

Properties

Link copied to clipboard

Color hex regex pattern.

Link copied to clipboard

Color hex regex.Supported formats are #RRGGBB and #AARRGGBB.

Link copied to clipboard

Map of color opacity.

Link copied to clipboard

Map of color transparency.

Functions

Link copied to clipboard
fun colorHex2ARGB(colorHex: String, default: String = "#00000000"): IntArray

Converting color hexadecimal string to an array of ARGB.

Link copied to clipboard
fun colorHex2Int(colorHex: String, default: String = "#00000000"): Int

Parse the color string, and return the corresponding color-int.

Link copied to clipboard
fun colorInt2ARGB(@ColorInt colorInt: Int, @ColorInt default: Int = Color.TRANSPARENT): IntArray

Converting color-int to an array of ARGB.

Link copied to clipboard
fun colorInt2Hex(@ColorInt colorInt: Int, @ColorInt default: Int = Color.TRANSPARENT): String

Converting color-int to string.

Link copied to clipboard

Converting an argb array to color string.

Link copied to clipboard
fun getColorIntWithTransparency(@IntRange(from = 0, to = 100) transparency: Int, colorInt: Int): Int

Get the color-int by transparency and colorInt.

Link copied to clipboard
fun getColorWithTransparency(@IntRange(from = 0, to = 100) transparency: Int, colorInt: Int): String

Get the color hex in the format of #AARRGGBB by transparency and colorInt.

Link copied to clipboard
fun isColorHex(vararg colorHex: String): Boolean

Return true if the color hex string is right,false otherwise.