Fixed color scheme for light theme

This commit is contained in:
Abdelilah El Aissaoui 2022-08-07 17:24:13 +02:00
parent 4de4c5f76a
commit 975b0730d9
5 changed files with 19 additions and 15 deletions

View File

@ -77,12 +77,6 @@ val Colors.conflictFile: Color
val Colors.headerText: Color val Colors.headerText: Color
get() = appTheme.onHeader get() = appTheme.onHeader
val Colors.stageButton: Color
get() = appTheme.primary
val Colors.unstageButton: Color
get() = appTheme.error
val Colors.abortButton: Color val Colors.abortButton: Color
get() = appTheme.error get() = appTheme.error

View File

@ -302,16 +302,17 @@ fun HunkHeader(
val color: Color val color: Color
if (diffEntryType is DiffEntryType.StagedDiff) { if (diffEntryType is DiffEntryType.StagedDiff) {
buttonText = "Unstage hunk" buttonText = "Unstage hunk"
color = MaterialTheme.colors.unstageButton color = MaterialTheme.colors.error
} else { } else {
buttonText = "Stage hunk" buttonText = "Stage hunk"
color = MaterialTheme.colors.stageButton color = MaterialTheme.colors.primary
} }
if (diffEntryType is DiffEntryType.UnstagedDiff) { if (diffEntryType is DiffEntryType.UnstagedDiff) {
SecondaryButton( SecondaryButton(
text = "Discard hunk", text = "Discard hunk",
backgroundButton = MaterialTheme.colors.error, backgroundButton = MaterialTheme.colors.error,
textColor = MaterialTheme.colors.onError,
onClick = onResetHunk onClick = onResetHunk
) )
} }
@ -367,10 +368,10 @@ fun DiffHeader(
if (diffEntryType is DiffEntryType.StagedDiff) { if (diffEntryType is DiffEntryType.StagedDiff) {
buttonText = "Unstage file" buttonText = "Unstage file"
color = MaterialTheme.colors.unstageButton color = MaterialTheme.colors.error
} else { } else {
buttonText = "Stage file" buttonText = "Stage file"
color = MaterialTheme.colors.stageButton color = MaterialTheme.colors.primary
} }
SecondaryButton( SecondaryButton(

View File

@ -111,7 +111,8 @@ fun UncommitedChanges(
allActionTitle = "Unstage all", allActionTitle = "Unstage all",
actionTitle = "Unstage", actionTitle = "Unstage",
selectedEntryType = if (selectedEntryType is DiffEntryType.StagedDiff) selectedEntryType else null, selectedEntryType = if (selectedEntryType is DiffEntryType.StagedDiff) selectedEntryType else null,
actionColor = MaterialTheme.colors.unstageButton, actionColor = MaterialTheme.colors.error,
actionTextColor = MaterialTheme.colors.onError,
statusEntries = staged, statusEntries = staged,
lazyListState = stagedListState, lazyListState = stagedListState,
onDiffEntrySelected = onStagedDiffEntrySelected, onDiffEntrySelected = onStagedDiffEntrySelected,
@ -140,7 +141,8 @@ fun UncommitedChanges(
title = "Unstaged", title = "Unstaged",
actionTitle = "Stage", actionTitle = "Stage",
selectedEntryType = if (selectedEntryType is DiffEntryType.UnstagedDiff) selectedEntryType else null, selectedEntryType = if (selectedEntryType is DiffEntryType.UnstagedDiff) selectedEntryType else null,
actionColor = MaterialTheme.colors.stageButton, actionColor = MaterialTheme.colors.primary,
actionTextColor = MaterialTheme.colors.onPrimary,
statusEntries = unstaged, statusEntries = unstaged,
lazyListState = unstagedListState, lazyListState = unstagedListState,
onDiffEntrySelected = onUnstagedDiffEntrySelected, onDiffEntrySelected = onUnstagedDiffEntrySelected,
@ -481,13 +483,14 @@ fun ConfirmationButton(
} }
} }
@OptIn(ExperimentalAnimationApi::class, ExperimentalFoundationApi::class) @OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
private fun EntriesList( private fun EntriesList(
modifier: Modifier, modifier: Modifier,
title: String, title: String,
actionTitle: String, actionTitle: String,
actionColor: Color, actionColor: Color,
actionTextColor: Color,
statusEntries: List<StatusEntry>, statusEntries: List<StatusEntry>,
lazyListState: LazyListState, lazyListState: LazyListState,
onDiffEntrySelected: (StatusEntry) -> Unit, onDiffEntrySelected: (StatusEntry) -> Unit,
@ -518,6 +521,7 @@ private fun EntriesList(
modifier = Modifier.align(Alignment.CenterEnd), modifier = Modifier.align(Alignment.CenterEnd),
text = allActionTitle, text = allActionTitle,
backgroundButton = actionColor, backgroundButton = actionColor,
textColor = actionTextColor,
onClick = onAllAction onClick = onAllAction
) )
} }

View File

@ -7,6 +7,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import app.theme.primaryTextColor
@Composable @Composable
fun PrimaryButton( fun PrimaryButton(
@ -14,6 +15,7 @@ fun PrimaryButton(
text: String, text: String,
enabled: Boolean = true, enabled: Boolean = true,
textColor: Color = MaterialTheme.colors.onPrimary, textColor: Color = MaterialTheme.colors.onPrimary,
disabledTextColor: Color = MaterialTheme.colors.primaryTextColor,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
Button( Button(
@ -25,6 +27,9 @@ fun PrimaryButton(
contentColor = textColor contentColor = textColor
), ),
) { ) {
Text(text) Text(
text,
color = if(enabled) textColor else disabledTextColor
)
} }
} }

View File

@ -17,7 +17,7 @@ import app.extensions.handMouseClickable
fun SecondaryButton( fun SecondaryButton(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
text: String, text: String,
textColor: Color = Color.White, textColor: Color = MaterialTheme.colors.onPrimary,
backgroundButton: Color, backgroundButton: Color,
maxLines: Int = 1, maxLines: Int = 1,
onClick: () -> Unit, onClick: () -> Unit,