mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Extract colors to avoid duplication and for more clarity.
This commit is contained in:
+14
-9
@@ -218,25 +218,30 @@ private fun LineRow(
|
|||||||
private fun String.toColor(colorationMode: ColorationMode): Color {
|
private fun String.toColor(colorationMode: ColorationMode): Color {
|
||||||
return when (colorationMode) {
|
return when (colorationMode) {
|
||||||
ColorationMode.Logcat -> when (getOrNull(31)) {
|
ColorationMode.Logcat -> when (getOrNull(31)) {
|
||||||
'D' -> Color(0xFF299999)
|
'D' -> colorDebug
|
||||||
'I' -> Color(0xFFABC023)
|
'I' -> colorInfo
|
||||||
'W' -> Color(0xFFBBB529)
|
'W' -> colorWarning
|
||||||
'E' -> Color(0xFFFF6B68)
|
'E' -> colorError
|
||||||
'A' -> Color(0xFFFF6B68)
|
'A' -> colorError
|
||||||
else -> ElementTheme.colors.textPrimary
|
else -> ElementTheme.colors.textPrimary
|
||||||
}
|
}
|
||||||
ColorationMode.RustLogs -> when (getOrNull(32)) {
|
ColorationMode.RustLogs -> when (getOrNull(32)) {
|
||||||
'E' -> ElementTheme.colors.textPrimary
|
'E' -> ElementTheme.colors.textPrimary
|
||||||
'G' -> Color(0xFF299999)
|
'G' -> colorDebug
|
||||||
'0' -> Color(0xFFABC023)
|
'0' -> colorInfo
|
||||||
'N' -> Color(0xFFBBB529)
|
'N' -> colorWarning
|
||||||
'R' -> Color(0xFFFF6B68)
|
'R' -> colorError
|
||||||
else -> ElementTheme.colors.textPrimary
|
else -> ElementTheme.colors.textPrimary
|
||||||
}
|
}
|
||||||
ColorationMode.None -> ElementTheme.colors.textPrimary
|
ColorationMode.None -> ElementTheme.colors.textPrimary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val colorDebug = Color(0xFF299999)
|
||||||
|
private val colorInfo = Color(0xFFABC023)
|
||||||
|
private val colorWarning = Color(0xFFBBB529)
|
||||||
|
private val colorError = Color(0xFFFF6B68)
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun ViewFileViewPreview(@PreviewParameter(ViewFileStateProvider::class) state: ViewFileState) = ElementPreview {
|
internal fun ViewFileViewPreview(@PreviewParameter(ViewFileStateProvider::class) state: ViewFileState) = ElementPreview {
|
||||||
|
|||||||
Reference in New Issue
Block a user