Updated on 2026-08-14
This commit is contained in:
parent
c4636aaa16
commit
3fbddfa8c7
5 changed files with 47 additions and 16 deletions
|
|
@ -26,8 +26,11 @@ val CryptoCurrency.networkIconResId: Int
|
|||
* @param fallbackColor The color to use as a fallback.
|
||||
* @return The extracted background color or the fallback color if extraction fails or if it is a test network token.
|
||||
*/
|
||||
fun CryptoCurrency.Token.tryGetBackgroundForTokenIcon(fallbackColor: Color = TangemColorPalette.Black): Color {
|
||||
if (network.isTestnet) return fallbackColor
|
||||
fun CryptoCurrency.Token.tryGetBackgroundForTokenIcon(
|
||||
isGrayscale: Boolean,
|
||||
fallbackColor: Color = TangemColorPalette.Black,
|
||||
): Color {
|
||||
if (isGrayscale) return TangemColorPalette.Dark2
|
||||
|
||||
return try {
|
||||
val colorHex = "#" + contractAddress.substring(range = COLOR_HEX_START_INDEX..COLOR_HEX_END_INDEX)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue