Skip to content

Commit

Permalink
Merge pull request #927 from svenjacobs/issue-926-dialog-confirm-color
Browse files Browse the repository at this point in the history
Allow styling of dialog's confirm button color
  • Loading branch information
mikepenz authored Sep 26, 2023
2 parents 2fa8c11 + 69061f0 commit 2a4ad33
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ fun LicenseDialog(
.align(Alignment.End)
.padding(horizontal = 8.dp, vertical = 2.dp)
) {
TextButton(onClick = onDismiss) {
TextButton(
onClick = onDismiss,
colors = ButtonDefaults.textButtonColors(
contentColor = colors.dialogConfirmButtonColor,
)
) {
Text(confirmText)
}
}
Expand Down Expand Up @@ -295,18 +300,21 @@ object LibraryDefaults {
* @param contentColor the content color of this [Library]
* @param badgeBackgroundColor the badge background color of this [Library]
* @param badgeContentColor the badge content color of this [Library]
* @param dialogConfirmButtonColor the dialog's confirm button color of this [Library]
*/
@Composable
fun libraryColors(
backgroundColor: Color = MaterialTheme.colors.background,
contentColor: Color = contentColorFor(backgroundColor),
badgeBackgroundColor: Color = MaterialTheme.colors.primary,
badgeContentColor: Color = contentColorFor(badgeBackgroundColor),
dialogConfirmButtonColor: Color = MaterialTheme.colors.primary,
): LibraryColors = DefaultLibraryColors(
backgroundColor = backgroundColor,
contentColor = contentColor,
badgeBackgroundColor = badgeBackgroundColor,
badgeContentColor = badgeContentColor
badgeContentColor = badgeContentColor,
dialogConfirmButtonColor = dialogConfirmButtonColor,
)

/**
Expand Down Expand Up @@ -350,6 +358,9 @@ interface LibraryColors {

/** Represents the badge content color for this library item. */
val badgeContentColor: Color

/** Represents the text color of the dialog's confirm button */
val dialogConfirmButtonColor: Color
}

/**
Expand All @@ -361,6 +372,7 @@ private class DefaultLibraryColors(
override val contentColor: Color,
override val badgeBackgroundColor: Color,
override val badgeContentColor: Color,
override val dialogConfirmButtonColor: Color,
) : LibraryColors


Expand Down

0 comments on commit 2a4ad33

Please sign in to comment.