Declare colors statically

This commit is contained in:
Andrew 2024-06-13 11:56:34 +09:30
parent cd53533235
commit 9721dbbd9e

View File

@ -97,37 +97,77 @@ val dangerLight = Color(0xFFE12D19)
val disabledDark = Color(0xFFA1A2A1) val disabledDark = Color(0xFFA1A2A1)
val disabledLioht = Color(0xFF6D6D6D) val disabledLioht = Color(0xFF6D6D6D)
val primaryColors = listOf(
primaryGreen,
primaryBlue,
primaryPurple,
primaryPink,
primaryRed,
primaryOrange,
primaryYellow,
)
fun sessionColors( fun sessionColors(
isLight: Boolean, isLight: Boolean,
isClassic: Boolean, isClassic: Boolean,
primary: Color = if (isClassic) primaryGreen else primaryBlue primary: Color = if (isClassic) primaryGreen else primaryBlue
): SessionColors { ): SessionColors = if (isClassic) {
val index = (if (isLight) 1 else 0) + if (isClassic) 0 else 2 if (isLight) classicLight else classicDark
return SessionColors( } else {
isLight = isLight, if (isLight) oceanLight else oceanDark
primary = primary, }.copy(
danger = if (isLight) dangerLight else dangerDark, primary = primary
disabled = if (isLight) disabledLioht else disabledDark, )
background = listOf(Color.Black, Color.White, oceanDark2, oceanLight7)[index],
backgroundSecondary = listOf(classicDark1, classicLight5, oceanDark1, oceanLight6)[index], val classicDark = SessionColors(
text = listOf(Color.White, Color.Black, Color.White, oceanLight1)[index], isLight = false,
textSecondary = listOf(classicDark5, classicLight1, oceanDark5, oceanLight2)[index], primary = primaryGreen,
borders = listOf(classicDark3, classicLight3, oceanDark4, oceanLight3)[index], danger = dangerDark,
textBubbleSent = listOf(Color.Black, Color.Black, Color.Black, oceanLight1)[index], disabled = disabledDark,
backgroundBubbleReceived = listOf(classicDark2, classicLight4, oceanDark4, oceanLight4)[index], background = Color.Black,
textBubbleReceived = listOf(Color.White, classicLight4, oceanDark4, oceanLight4)[index], backgroundSecondary = classicDark1,
text = Color.White,
textSecondary = classicDark5,
borders = classicDark3,
textBubbleSent = Color.Black,
backgroundBubbleReceived = classicDark2,
textBubbleReceived = Color.White,
)
val classicLight = SessionColors(
isLight = true,
primary = primaryGreen,
danger = dangerLight,
disabled = disabledLioht,
background = Color.White,
backgroundSecondary = classicLight5,
text = Color.Black,
textSecondary = classicLight1,
borders = classicLight3,
textBubbleSent = Color.Black,
backgroundBubbleReceived = classicLight4,
textBubbleReceived = classicLight4,
)
val oceanDark = SessionColors(
isLight = false,
primary = primaryBlue,
danger = dangerDark,
disabled = disabledDark,
background = oceanDark2,
backgroundSecondary = oceanDark1,
text = Color.White,
textSecondary = oceanDark5,
borders = oceanDark4,
textBubbleSent = Color.Black,
backgroundBubbleReceived = oceanDark4,
textBubbleReceived = oceanDark4,
)
val oceanLight = SessionColors(
isLight = true,
primary = primaryBlue,
danger = dangerLight,
disabled = disabledLioht,
background = oceanLight7,
backgroundSecondary = oceanLight6,
text = oceanLight1,
textSecondary = oceanLight2,
borders = oceanLight3,
textBubbleSent = oceanLight1,
backgroundBubbleReceived = oceanLight4,
textBubbleReceived = oceanLight4
) )
}
@Composable @Composable
fun transparentButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent) fun transparentButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent)