diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt index 154532b10c..46631b08b7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt @@ -45,12 +45,12 @@ import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2 import org.thoughtcrime.securesms.dependencies.DatabaseComponent import org.thoughtcrime.securesms.showOpenUrlDialog import org.thoughtcrime.securesms.ui.LoadingArcOr +import org.thoughtcrime.securesms.ui.LocalColors import org.thoughtcrime.securesms.ui.LocalDimensions import org.thoughtcrime.securesms.ui.PreviewTheme import org.thoughtcrime.securesms.ui.SessionColors import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider import org.thoughtcrime.securesms.ui.SessionMaterialTheme -import org.thoughtcrime.securesms.ui.classicDarkColors import org.thoughtcrime.securesms.ui.components.AppBar import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode @@ -169,7 +169,7 @@ fun EnterAccountId( BorderlessButtonWithIcon( text = stringResource(R.string.messageNewDescription), iconRes = R.drawable.ic_circle_question_mark, - contentColor = classicDarkColors[5], + contentColor = LocalColors.current.textSecondary, modifier = Modifier .contentDescription(R.string.AccessibilityId_help_desk_link) .fillMaxWidth() diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt index 7fad8c4e5e..56696915f2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt @@ -31,8 +31,8 @@ import network.loki.messenger.R import org.session.libsession.utilities.TextSecurePreferences import org.thoughtcrime.securesms.preferences.copyPublicKey import org.thoughtcrime.securesms.preferences.sendInvitationToUseSession +import org.thoughtcrime.securesms.ui.LocalColors import org.thoughtcrime.securesms.ui.base -import org.thoughtcrime.securesms.ui.classicDarkColors import org.thoughtcrime.securesms.ui.components.AppBar import org.thoughtcrime.securesms.ui.components.OutlineButton import org.thoughtcrime.securesms.ui.components.OutlineCopyButton @@ -83,7 +83,7 @@ private fun InviteFriend( modifier = Modifier .border( width = 1.dp, - color = classicDarkColors[5], + color = LocalColors.current.textSecondary, shape = RoundedCornerShape(size = 13.dp) ) .fillMaxWidth() @@ -104,7 +104,7 @@ private fun InviteFriend( stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them), textAlign = TextAlign.Center, style = MaterialTheme.typography.small, - color = classicDarkColors[5], + color = LocalColors.current.textSecondary, modifier = Modifier.padding(horizontal = 8.dp) ) SmallButtons { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt index 48451e003c..9058e3dbe5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt @@ -21,8 +21,8 @@ import network.loki.messenger.R import org.session.libsession.utilities.TextSecurePreferences import org.thoughtcrime.securesms.ui.Divider import org.thoughtcrime.securesms.ui.ItemButton +import org.thoughtcrime.securesms.ui.LocalColors import org.thoughtcrime.securesms.ui.LocalDimensions -import org.thoughtcrime.securesms.ui.classicDarkColors import org.thoughtcrime.securesms.ui.components.AppBar import org.thoughtcrime.securesms.ui.components.QrImage import org.thoughtcrime.securesms.ui.contentDescription @@ -68,7 +68,7 @@ class NewConversationHomeFragment : Fragment() { Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny)) Text( text = stringResource(R.string.qrYoursDescription), - color = classicDarkColors[5], + color = LocalColors.current.textSecondary, style = MaterialTheme.typography.small ) Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall)) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Carousel.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Carousel.kt index 76c3ba83f9..2f46e37200 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Carousel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Carousel.kt @@ -56,7 +56,7 @@ fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) { pagerState = pagerState, pageCount = pagerState.pageCount, activeColor = Color.White, - inactiveColor = classicDarkColors[5]) + inactiveColor = LocalColors.current.textSecondary) } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt index 162496b7cd..49a39d7296 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt @@ -20,57 +20,44 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import org.session.libsession.utilities.AppTextSecurePreferences import org.session.libsession.utilities.TextSecurePreferences -import org.thoughtcrime.securesms.util.ThemeState -import org.thoughtcrime.securesms.util.themeState -const val classicDark0 = 0xff111111 -const val classicDark1 = 0xff1B1B1B -const val classicDark2 = 0xff2D2D2D -const val classicDark3 = 0xff414141 -const val classicDark4 = 0xff767676 -const val classicDark5 = 0xffA1A2A1 -const val classicDark6 = 0xffFFFFFF +val classicDark0 = Color(0xff111111) +val classicDark1 = Color(0xff1B1B1B) +val classicDark2 = Color(0xff2D2D2D) +val classicDark3 = Color(0xff414141) +val classicDark4 = Color(0xff767676) +val classicDark5 = Color(0xffA1A2A1) +val classicDark6 = Color(0xffFFFFFF) -const val classicLight0 = 0xff000000 -const val classicLight1 = 0xff6D6D6D -const val classicLight2 = 0xffA1A2A1 -const val classicLight3 = 0xffDFDFDF -const val classicLight4 = 0xffF0F0F0 -const val classicLight5 = 0xffF9F9F9 -const val classicLight6 = 0xffFFFFFF +val classicLight0 = Color(0xff000000) +val classicLight1 = Color(0xff6D6D6D) +val classicLight2 = Color(0xffA1A2A1) +val classicLight3 = Color(0xffDFDFDF) +val classicLight4 = Color(0xffF0F0F0) +val classicLight5 = Color(0xffF9F9F9) +val classicLight6 = Color(0xffFFFFFF) -const val oceanDark0 = 0xff000000 -const val oceanDark1 = 0xff1A1C28 -const val oceanDark2 = 0xff252735 -const val oceanDark3 = 0xff2B2D40 -const val oceanDark4 = 0xff3D4A5D -const val oceanDark5 = 0xffA6A9CE -const val oceanDark6 = 0xff5CAACC -const val oceanDark7 = 0xffFFFFFF +val oceanDark0 = Color(0xff000000) +val oceanDark1 = Color(0xff1A1C28) +val oceanDark2 = Color(0xff252735) +val oceanDark3 = Color(0xff2B2D40) +val oceanDark4 = Color(0xff3D4A5D) +val oceanDark5 = Color(0xffA6A9CE) +val oceanDark6 = Color(0xff5CAACC) +val oceanDark7 = Color(0xffFFFFFF) -const val oceanLight0 = 0xff000000 -const val oceanLight1 = 0xff19345D -const val oceanLight2 = 0xff6A6E90 -const val oceanLight3 = 0xff5CAACC -const val oceanLight4 = 0xffB3EDF2 -const val oceanLight5 = 0xffE7F3F4 -const val oceanLight6 = 0xffECFAFB -const val oceanLight7 = 0xffFCFFFF +val oceanLight0 = Color(0xff000000) +val oceanLight1 = Color(0xff19345D) +val oceanLight2 = Color(0xff6A6E90) +val oceanLight3 = Color(0xff5CAACC) +val oceanLight4 = Color(0xffB3EDF2) +val oceanLight5 = Color(0xffE7F3F4) +val oceanLight6 = Color(0xffECFAFB) +val oceanLight7 = Color(0xffFCFFFF) val Colors.disabled @Composable get() = onSurface.copy(alpha = ContentAlpha.disabled) -val oceanLights = arrayOf(oceanLight0, oceanLight1, oceanLight2, oceanLight3, oceanLight4, oceanLight5, oceanLight6, oceanLight7) -val oceanDarks = arrayOf(oceanDark0, oceanDark1, oceanDark2, oceanDark3, oceanDark4, oceanDark5, oceanDark6, oceanDark7) -val classicLights = arrayOf(classicLight0, classicLight1, classicLight2, classicLight3, classicLight4, classicLight5, classicLight6) -val classicDarks = arrayOf(classicDark0, classicDark1, classicDark2, classicDark3, classicDark4, classicDark5, classicDark6) - -val oceanLightColors = oceanLights.map(::Color) -val oceanDarkColors = oceanDarks.map(::Color) -val classicLightColors = classicLights.map(::Color) -val classicDarkColors = classicDarks.map(::Color) - val blackAlpha40 = Color.Black.copy(alpha = 0.4f) val LocalColors = staticCompositionLocalOf { sessionColors(isLight = false, isClassic = true) } @@ -120,13 +107,6 @@ val primaryColors = listOf( primaryYellow, ) -private class UnresolvedColor(val function: (Boolean, Boolean) -> Color) { - operator fun invoke(isLight: Boolean, isClassic: Boolean) = function(isLight, isClassic) - - constructor(light: Color, dark: Color): this(function = { isLight, _ -> if (isLight) light else dark }) - constructor(classicDark: Color, classicLight: Color, oceanDark: Color, oceanLight: Color): this(function = { isLight, isClassic -> if (isLight) if (isClassic) classicLight else oceanLight else if (isClassic) classicDark else oceanDark }) -} - fun sessionColors( isLight: Boolean, isClassic: Boolean, @@ -138,14 +118,14 @@ fun sessionColors( primary = primary, danger = if (isLight) dangerLight else dangerDark, disabled = if (isLight) disabledLioht else disabledDark, - background = listOf(Color.Black, Color.White, oceanDarkColors[2], oceanLightColors[7])[index], - backgroundSecondary = listOf(classicDarkColors[1], classicLightColors[5], oceanDarkColors[1], oceanLightColors[6])[index], - text = listOf(Color.White, Color.Black, Color.White, oceanLightColors[1])[index], - textSecondary = listOf(classicDarkColors[5], classicLightColors[1], oceanDarkColors[5], oceanLightColors[2])[index], - borders = listOf(classicDarkColors[3], classicLightColors[3], oceanDarkColors[4], oceanLightColors[3])[index], - textBubbleSent = listOf(Color.Black, Color.Black, Color.Black, oceanLightColors[1])[index], - backgroundBubbleReceived = listOf(classicDarkColors[2], classicLightColors[4], oceanDarkColors[4], oceanLightColors[4])[index], - textBubbleReceived = listOf(Color.White, classicLightColors[4], oceanDarkColors[4], oceanLightColors[4])[index], + background = listOf(Color.Black, Color.White, oceanDark2, oceanLight7)[index], + backgroundSecondary = listOf(classicDark1, classicLight5, oceanDark1, oceanLight6)[index], + text = listOf(Color.White, Color.Black, Color.White, oceanLight1)[index], + textSecondary = listOf(classicDark5, classicLight1, oceanDark5, oceanLight2)[index], + borders = listOf(classicDark3, classicLight3, oceanDark4, oceanLight3)[index], + textBubbleSent = listOf(Color.Black, Color.Black, Color.Black, oceanLight1)[index], + backgroundBubbleReceived = listOf(classicDark2, classicLight4, oceanDark4, oceanLight4)[index], + textBubbleReceived = listOf(Color.White, classicLight4, oceanDark4, oceanLight4)[index], ) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt index a90ff49bf8..4ce77260c4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt @@ -1,7 +1,6 @@ package org.thoughtcrime.securesms.ui import android.content.Context -import androidx.annotation.AttrRes import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box @@ -15,10 +14,8 @@ import androidx.compose.material.Shapes import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.google.android.material.color.MaterialColors import org.session.libsession.utilities.AppTextSecurePreferences import org.thoughtcrime.securesms.util.ThemeState import org.thoughtcrime.securesms.util.themeState