Fix top app bar status icon contrast

The tor/proxy shield icon was tinted with hardcoded Color.Green and
Color.Red. Pure green sits on the lightColorPalette surface for the top
app bar (amber 0xFFFFDE9E) with a ~1:1 contrast ratio, so the connected
state was invisible in light theme, and neither color adapted to dark
theme. Add theme-aware connected greens to Theme.kt (dark green for the
light palette, light green for dark) and pick them with
isSystemInDarkTheme(); the disconnected state now uses
colorScheme.error, which is already theme-aware.

The relay reconnect icon drew with the hardcoded #4C4C4C fill of
relays.xml (tint Color.Unspecified), only ~2:1 on the dark theme
surface. Tint it with LocalContentColor so it matches the adjacent
relay count text; the drawable itself is left alone since the settings
screen and the navigation route icon also use it.
This commit is contained in:
greenart7c3
2026-09-25 12:58:40 -03:00
parent dd2aeb74f7
commit 52a91e89db
2 changed files with 13 additions and 3 deletions
@@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.widget.Toast import android.widget.Toast
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
@@ -12,6 +13,8 @@ import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.PlainTooltip import androidx.compose.material3.PlainTooltip
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TooltipAnchorPosition import androidx.compose.material3.TooltipAnchorPosition
@@ -28,7 +31,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
@@ -50,6 +52,8 @@ import com.greenart7c3.nostrsigner.ui.NavBackStackEntryWrapper
import com.greenart7c3.nostrsigner.ui.navigation.Route import com.greenart7c3.nostrsigner.ui.navigation.Route
import com.greenart7c3.nostrsigner.ui.navigation.routes import com.greenart7c3.nostrsigner.ui.navigation.routes
import com.greenart7c3.nostrsigner.ui.navigation.title import com.greenart7c3.nostrsigner.ui.navigation.title
import com.greenart7c3.nostrsigner.ui.theme.connectedColorDark
import com.greenart7c3.nostrsigner.ui.theme.connectedColorLight
import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestConnect import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestConnect
import java.util.Base64 import java.util.Base64
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
@@ -107,7 +111,7 @@ fun AmberTopAppBar(
Icon( Icon(
imageVector = ImageVector.vectorResource(R.drawable.relays), imageVector = ImageVector.vectorResource(R.drawable.relays),
contentDescription = context.getString(R.string.reconnect), contentDescription = context.getString(R.string.reconnect),
tint = Color.Unspecified, tint = LocalContentColor.current,
) )
} }
} }
@@ -160,7 +164,11 @@ fun AmberTopAppBar(
Icon( Icon(
Icons.Outlined.Shield, Icons.Outlined.Shield,
context.getString(R.string.proxy), context.getString(R.string.proxy),
tint = if (isProxyEnabled) Color.Green else Color.Red, tint = if (isProxyEnabled) {
if (isSystemInDarkTheme()) connectedColorDark else connectedColorLight
} else {
MaterialTheme.colorScheme.error
},
) )
}, },
) )
@@ -37,6 +37,8 @@ val primaryColor = Color(0xFFFFCA62)
val primaryVariant = Color(0xFFC8541A) val primaryVariant = Color(0xFFC8541A)
val secondaryColor = Color(0xFFFFCA62) val secondaryColor = Color(0xFFFFCA62)
val orange = Color(0xFFFF6B00) val orange = Color(0xFFFF6B00)
val connectedColorLight = Color(0xFF1B5E20)
val connectedColorDark = Color(0xFF81C784)
private val DarkColorPalette = private val DarkColorPalette =
darkColorScheme( darkColorScheme(