Extract colors to avoid duplication and for more clarity.
This commit is contained in:
parent
52e0137904
commit
407d1cab24
1 changed files with 14 additions and 9 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue