Skip to content

ColorStringFormatter

Xavier F. Gouchet edited this page Sep 4, 2024 · 1 revision

interface ColorStringFormatter

A utility interface to convert Android/JVM colors to web hexadecimal strings. This interface is meant for internal usage, please use it carefully.

Inheritors

DefaultColorStringFormatter

Functions

formatColorAndAlphaAsHexString

abstract fun formatColorAndAlphaAsHexString(color: Int, alpha: Int): String

Converts a color as an int to a standard web hexadecimal representation, as RGBA (e.g.: #A538AFFF). If also overrides the color's alpha channel

Return

new color value as a HTML formatted hexadecimal String

Parameters
color the color value (with or without alpha in the first 8 bits)
alpha the override alpha in a O…255 range

formatColorAsHexString

abstract fun formatColorAsHexString(color: Int): String

Converts a color as an int to a standard web hexadecimal representation, as RGBA (e.g.: #A538AFFF).

Return

new color value as a HTML formatted hexadecimal String

Parameters
color the color value (with or without alpha in the first 8 bits)
Clone this wiki locally