🛠️ Reformat BlackTheme .copy() function

* Removed .copy() function and replaced with .run()
This commit is contained in:
Acclorite 2024-09-07 16:20:44 +03:00
parent 83260d354d
commit 3de024457b

View file

@ -12,12 +12,12 @@ fun blackTheme(initialTheme: ColorScheme): ColorScheme {
val surfaceContainerDarker = if (absoluteDark) 3f else 1.95f val surfaceContainerDarker = if (absoluteDark) 3f else 1.95f
return initialTheme.copy( return initialTheme.copy(
surface = initialTheme.surface.copy { surface = initialTheme.surface.run {
if (absoluteDark) { if (absoluteDark) {
return@copy Color.Black return@run Color.Black
} }
it.darkenBy(surfaceDarker) darkenBy(surfaceDarker)
}, },
surfaceContainer = initialTheme.surfaceContainer.darkenBy( surfaceContainer = initialTheme.surfaceContainer.darkenBy(
surfaceContainerDarker surfaceContainerDarker
@ -37,10 +37,6 @@ fun blackTheme(initialTheme: ColorScheme): ColorScheme {
) )
} }
private fun Color.copy(calculation: (Color) -> Color): Color {
return calculation(this)
}
private fun Color.darkenBy(value: Float): Color { private fun Color.darkenBy(value: Float): Color {
return copy( return copy(
red = red / value, red = red / value,