Skip to content

Commit

Permalink
[optimize] Integrate Light and Dark Color Schemes for Price Change …
Browse files Browse the repository at this point in the history
…Indicator
  • Loading branch information
mhmd-android committed Oct 28, 2023
1 parent e758cb5 commit 46d16a1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color.Companion.Green
import androidx.compose.ui.graphics.Color.Companion.Red
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
import ir.composenews.designsystem.R
import ir.composenews.designsystem.preview.ThemePreviews
import ir.composenews.designsystem.theme.ComposeNewsTheme
import ir.composenews.designsystem.theme.darkDownTrendRed
import ir.composenews.designsystem.theme.darkUptrendGreen
import ir.composenews.designsystem.theme.lightDownTrendRed
import ir.composenews.designsystem.theme.lightUptrendGreen
import kotlinx.coroutines.delay
import java.util.Locale

Expand Down Expand Up @@ -192,7 +194,8 @@ private fun MarketItemCard(
Text(
text = "$priceChangePercentage24h %",
style = MaterialTheme.typography.bodyLarge,
color = if (priceChangePercentage24h.contains("-")) Red else Green,
color = if (priceChangePercentage24h.contains("-")) if (isSystemInDarkTheme()) darkDownTrendRed else lightDownTrendRed
else if (isSystemInDarkTheme()) darkUptrendGreen else lightUptrendGreen,
)
}
}
Expand All @@ -215,7 +218,8 @@ private fun ArrowIconUpOrDown(priceChangePercentage24h: String) {
painterResource(id = R.drawable.baseline_arrow_upward_24)
},
contentDescription = "",
tint = if (priceChangePercentage24h.contains("-")) Red else Green,
tint = if (priceChangePercentage24h.contains("-")) if (isSystemInDarkTheme()) darkDownTrendRed else lightDownTrendRed
else if (isSystemInDarkTheme()) darkUptrendGreen else lightUptrendGreen,
)
}

Expand Down

0 comments on commit 46d16a1

Please sign in to comment.