diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt index 0fedded4be..6aebdb1b32 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable @@ -221,14 +220,14 @@ private fun OrderedHeaderContent() { Text( text = stringResource(R.string.turn_on_autofill), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, ) Spacer(modifier = Modifier.height(8.dp)) Text( text = stringResource(R.string.use_autofill_to_log_into_your_accounts), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, // Apply similar line breaks to design modifier = Modifier.sizeIn(maxWidth = 300.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupCompleteScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupCompleteScreen.kt index 34afdee997..37a2b7899f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupCompleteScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupCompleteScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults @@ -92,7 +91,7 @@ private fun SetupCompleteContent( Text( text = stringResource(R.string.youre_all_set), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .align(CenterHorizontally) @@ -102,7 +101,7 @@ private fun SetupCompleteContent( Text( text = stringResource(R.string.what_bitwarden_has_to_offer), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .align(CenterHorizontally) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt index 166c76a744..3afb1374d5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -229,7 +228,7 @@ private fun ColumnScope.SetupUnlockHeaderPortrait() { Text( text = stringResource(id = R.string.set_up_unlock), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() @@ -243,7 +242,7 @@ private fun ColumnScope.SetupUnlockHeaderPortrait() { id = R.string.set_up_biometrics_or_choose_a_pin_code_to_quickly_access_your_vault_and_autofill_your_logins, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() @@ -275,7 +274,7 @@ private fun SetupUnlockHeaderLandscape( Text( text = stringResource(id = R.string.set_up_unlock), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth(), ) @@ -287,7 +286,7 @@ private fun SetupUnlockHeaderLandscape( id = R.string.set_up_biometrics_or_choose_a_pin_code_to_quickly_access_your_vault_and_autofill_your_logins, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth(), ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt index 3776479bcb..29e64e42da 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.ClickableText import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -151,7 +150,7 @@ private fun CheckEmailContent( text = stringResource(id = R.string.check_your_email), textAlign = TextAlign.Center, style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 8.dp) .wrapContentHeight() @@ -166,7 +165,7 @@ private fun CheckEmailContent( ), highlights = listOf(email), highlightStyle = SpanStyle( - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, fontWeight = FontWeight.Bold, ), @@ -186,7 +185,7 @@ private fun CheckEmailContent( Text( text = stringResource(R.string.select_the_link_in_the_email_to_verify_your_email_address_and_continue_creating_your_account), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .padding(horizontal = 8.dp) @@ -226,7 +225,7 @@ private fun CheckEmailLegacyContent( Spacer(modifier = Modifier.height(32.dp)) Image( painter = rememberVectorPainter(id = R.drawable.email_check), - colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary), + colorFilter = ColorFilter.tint(BitwardenTheme.colorScheme.icon.secondary), contentDescription = null, contentScale = ContentScale.FillHeight, modifier = Modifier @@ -239,7 +238,7 @@ private fun CheckEmailLegacyContent( text = stringResource(id = R.string.check_your_email), textAlign = TextAlign.Center, style = BitwardenTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 24.dp) .wrapContentHeight() @@ -255,7 +254,7 @@ private fun CheckEmailLegacyContent( ), highlights = listOf(email), highlightStyle = SpanStyle( - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, fontWeight = FontWeight.Bold, ), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreen.kt index 98d0696914..c2337905cf 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -142,8 +141,8 @@ fun CompleteRegistrationScreen( BitwardenTopAppBar( title = stringResource( id = R.string.create_account - .takeIf { state.onboardingEnabled } - ?: R.string.set_password), + .takeIf { state.onboardingEnabled } + ?: R.string.set_password), scrollBehavior = scrollBehavior, navigationIcon = rememberVectorPainter(id = R.drawable.ic_back), navigationIconContentDescription = stringResource(id = R.string.back), @@ -362,7 +361,7 @@ private fun LegacyHeaderContent( userEmail, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = modifier .fillMaxWidth(), ) @@ -386,7 +385,7 @@ private fun OrderedHeaderContent() { Text( text = stringResource(R.string.choose_your_master_password), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, ) Spacer(modifier = Modifier.height(8.dp)) @@ -395,7 +394,7 @@ private fun OrderedHeaderContent() { R.string.choose_a_unique_and_strong_password_to_keep_your_information_safe, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/PasswordStrengthIndicator.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/PasswordStrengthIndicator.kt index b8d428348a..abdc86b3f8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/PasswordStrengthIndicator.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/PasswordStrengthIndicator.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -31,7 +30,6 @@ import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors /** * Draws a password indicator that displays password strength based on the given [state]. @@ -56,12 +54,12 @@ fun PasswordStrengthIndicator( label = "Width Percent State", ) val indicatorColor = when (state) { - PasswordStrengthState.NONE -> MaterialTheme.colorScheme.error - PasswordStrengthState.WEAK_1 -> MaterialTheme.colorScheme.error - PasswordStrengthState.WEAK_2 -> MaterialTheme.colorScheme.error - PasswordStrengthState.WEAK_3 -> LocalNonMaterialColors.current.passwordWeak - PasswordStrengthState.GOOD -> MaterialTheme.colorScheme.primary - PasswordStrengthState.STRONG -> LocalNonMaterialColors.current.passwordStrong + PasswordStrengthState.NONE -> BitwardenTheme.colorScheme.status.error + PasswordStrengthState.WEAK_1 -> BitwardenTheme.colorScheme.status.error + PasswordStrengthState.WEAK_2 -> BitwardenTheme.colorScheme.status.weak2 + PasswordStrengthState.WEAK_3 -> BitwardenTheme.colorScheme.status.weak2 + PasswordStrengthState.GOOD -> BitwardenTheme.colorScheme.status.good + PasswordStrengthState.STRONG -> BitwardenTheme.colorScheme.status.strong } val animatedIndicatorColor by animateColorAsState( targetValue = indicatorColor, @@ -82,7 +80,7 @@ fun PasswordStrengthIndicator( Modifier .fillMaxWidth() .height(4.dp) - .background(MaterialTheme.colorScheme.surfaceContainerHigh), + .background(BitwardenTheme.colorScheme.sliderButton.unfilled), ) { Box( modifier = Modifier @@ -124,12 +122,11 @@ private fun MinimumCharacterCount( minimumRequirementMet: Boolean, minimumCharacterCount: Int, ) { - val nonMaterialColors = LocalNonMaterialColors.current val characterCountColor by animateColorAsState( targetValue = if (minimumRequirementMet) { - nonMaterialColors.passwordStrong + BitwardenTheme.colorScheme.status.strong } else { - MaterialTheme.colorScheme.surfaceDim + BitwardenTheme.colorScheme.text.secondary }, label = "minmumCharacterCountColor", ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountScreen.kt index 4732a1228e..be2562f414 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountScreen.kt @@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults @@ -77,6 +76,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.text.BitwardenClickableText import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch +import com.x8bit.bitwarden.ui.platform.components.toggle.color.bitwardenSwitchColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.composition.LocalIntentManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager @@ -309,7 +309,9 @@ private fun TermsAndPrivacySwitch( } .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onCheckedChange.invoke(!isChecked) }, ) .padding(start = 16.dp) @@ -321,12 +323,13 @@ private fun TermsAndPrivacySwitch( .width(52.dp), checked = isChecked, onCheckedChange = null, + colors = bitwardenSwitchColors(), ) Column(Modifier.padding(start = 16.dp, top = 4.dp, bottom = 4.dp)) { Text( text = stringResource(id = R.string.accept_policies), style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) FlowRow( horizontalArrangement = Arrangement.Start, @@ -340,12 +343,11 @@ private fun TermsAndPrivacySwitch( onClick = onTermsClick, style = BitwardenTheme.typography.bodyMedium, innerPadding = PaddingValues(vertical = 4.dp, horizontal = 0.dp), - color = MaterialTheme.colorScheme.primary, ) Text( text = ",", style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.padding(vertical = 4.dp), ) Spacer(modifier = Modifier.width(4.dp)) @@ -354,7 +356,6 @@ private fun TermsAndPrivacySwitch( onClick = onPrivacyPolicyClick, style = BitwardenTheme.typography.bodyMedium, innerPadding = PaddingValues(vertical = 4.dp, horizontal = 0.dp), - color = MaterialTheme.colorScheme.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt index 0f4cefebd2..becfb21bf9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -157,7 +156,7 @@ private fun EnterpriseSignOnScreenContent( text = stringResource(id = R.string.log_in_sso_summary), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkScreen.kt index 981d1dfc12..f90d2a7110 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable @@ -108,7 +107,7 @@ private fun ExpiredRegistrationLinkContent( Text( text = stringResource(R.string.expired_link), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() @@ -118,7 +117,7 @@ private fun ExpiredRegistrationLinkContent( Text( text = stringResource(R.string.please_restart_registration_or_try_logging_in), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt index bef0031c00..62b34b203c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -221,7 +220,7 @@ private fun LandingScreenContent( Image( painter = rememberVectorPainter(id = R.drawable.logo), - colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary), + colorFilter = ColorFilter.tint(BitwardenTheme.colorScheme.icon.secondary), contentDescription = null, modifier = Modifier .padding(horizontal = 16.dp) @@ -238,7 +237,7 @@ private fun LandingScreenContent( text = stringResource(id = R.string.login_or_create_new_account), textAlign = TextAlign.Center, style = BitwardenTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 24.dp) .wrapContentHeight(), @@ -306,7 +305,7 @@ private fun LandingScreenContent( Text( text = stringResource(id = R.string.new_around_here), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) BitwardenTextButton( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt index cf5740e5c1..1d708a4fa1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -307,7 +306,7 @@ private fun LoginScreenContent( ), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .testTag("LoggingInAsLabel") .padding(horizontal = 16.dp) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt index 951c9ec247..02f1641795 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -48,7 +47,6 @@ import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.composition.LocalIntentManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors /** * The top level composable for the Login with Device screen. @@ -146,7 +144,7 @@ private fun LoginWithDeviceScreenContent( text = state.title(), textAlign = TextAlign.Start, style = BitwardenTheme.typography.headlineMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -158,7 +156,7 @@ private fun LoginWithDeviceScreenContent( text = state.subtitle(), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -170,7 +168,7 @@ private fun LoginWithDeviceScreenContent( text = state.description(), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -182,7 +180,7 @@ private fun LoginWithDeviceScreenContent( text = stringResource(id = R.string.fingerprint_phrase), textAlign = TextAlign.Start, style = BitwardenTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -193,7 +191,7 @@ private fun LoginWithDeviceScreenContent( Text( text = state.fingerprintPhrase, textAlign = TextAlign.Start, - color = LocalNonMaterialColors.current.fingerprint, + color = BitwardenTheme.colorScheme.text.codePink, style = BitwardenTheme.typography.sensitiveInfoSmall, minLines = 2, modifier = Modifier @@ -233,7 +231,7 @@ private fun LoginWithDeviceScreenContent( text = state.otherOptions(), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordgenerator/MasterPasswordGeneratorScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordgenerator/MasterPasswordGeneratorScreen.kt index 2758c6b7a3..63bd8f7afc 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordgenerator/MasterPasswordGeneratorScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordgenerator/MasterPasswordGeneratorScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState @@ -166,12 +165,11 @@ private fun MasterPasswordGeneratorContent( Text( text = stringResource(R.string.write_this_password_down_and_keep_it_somewhere_safe), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) BitwardenClickableText( label = stringResource(R.string.learn_about_other_ways_to_prevent_account_lockout), style = BitwardenTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, onClick = onLearnToPreventLockout, innerPadding = PaddingValues(horizontal = 0.dp, vertical = 4.dp), ) @@ -194,7 +192,6 @@ private fun MasterPasswordGeneratorTopBar( actions = { BitwardenTextButton( label = stringResource(id = R.string.save), - labelTextColor = MaterialTheme.colorScheme.primary, onClick = onSaveClick, ) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt index c6708a3078..b26ea82485 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -93,7 +92,7 @@ fun MasterPasswordGuidanceScreen( modifier = Modifier .fillMaxWidth() .clip(RoundedCornerShape(size = 4.dp)) - .background(MaterialTheme.colorScheme.surfaceContainerLowest), + .background(BitwardenTheme.colorScheme.background.tertiary), ) { Column( modifier = Modifier @@ -104,18 +103,18 @@ fun MasterPasswordGuidanceScreen( Text( text = stringResource(R.string.what_makes_a_password_strong), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) Spacer(modifier = Modifier.height(8.dp)) Text( style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, text = stringResource( R.string.the_longer_your_password_the_more_difficult_to_hack, ), ) } - BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline) + BitwardenHorizontalDivider() Column( modifier = Modifier .fillMaxWidth() @@ -124,7 +123,7 @@ fun MasterPasswordGuidanceScreen( Text( text = stringResource(R.string.the_strongest_passwords_are_usually), style = BitwardenTheme.typography.titleSmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) Spacer(modifier = Modifier.height(8.dp)) BulletTextRow(text = stringResource(R.string.twelve_or_more_characters)) @@ -171,7 +170,7 @@ private fun TryGeneratorCard( Icon( painter = rememberVectorPainter(id = R.drawable.ic_navigate_next), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .align(Alignment.Center) .size(16.dp), @@ -194,13 +193,13 @@ private fun BulletTextRow( text = BULLET_TWO_TAB, textAlign = TextAlign.Center, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.clearAndSetSemantics { }, ) Text( text = text, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt index eda8d2915f..e53adee1ab 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt @@ -132,6 +132,7 @@ fun MasterPasswordHintScreen( Text( text = stringResource(id = R.string.enter_email_for_hint), style = BitwardenTheme.typography.bodySmall, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/preventaccountlockout/PreventAccountLockoutScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/preventaccountlockout/PreventAccountLockoutScreen.kt index e06e56af0e..f6d5a3dac3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/preventaccountlockout/PreventAccountLockoutScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/preventaccountlockout/PreventAccountLockoutScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -97,14 +96,13 @@ private fun NeverLoseAccessContent( modifier = modifier .fillMaxWidth() .clip(RoundedCornerShape(size = 4.dp)) - .background(MaterialTheme.colorScheme.surfaceContainerLowest), + .background(BitwardenTheme.colorScheme.background.tertiary), ) { Spacer(modifier = Modifier.height(24.dp)) Text( text = stringResource(R.string.never_lose_access_to_your_vault), style = BitwardenTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, - + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.padding(horizontal = 24.dp), ) Spacer(modifier = Modifier.height(8.dp)) @@ -113,11 +111,11 @@ private fun NeverLoseAccessContent( R.string.the_best_way_to_make_sure_you_can_always_access_your_account, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.padding(horizontal = 24.dp), ) Spacer(modifier = Modifier.height(24.dp)) - BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline) + BitwardenHorizontalDivider() Spacer(modifier = Modifier.height(16.dp)) AccountRecoveryTipRow( title = stringResource(R.string.create_a_hint), @@ -128,7 +126,7 @@ private fun NeverLoseAccessContent( modifier = Modifier.padding(horizontal = 16.dp), ) Spacer(modifier = Modifier.height(16.dp)) - BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline) + BitwardenHorizontalDivider() Spacer(modifier = Modifier.height(16.dp)) AccountRecoveryTipRow( title = stringResource(R.string.write_your_password_down), @@ -154,7 +152,7 @@ private fun AccountRecoveryTipRow( Icon( painter = icon, contentDescription = null, - tint = MaterialTheme.colorScheme.primary, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .size(32.dp) .clearAndSetSemantics { }, @@ -164,13 +162,13 @@ private fun AccountRecoveryTipRow( Text( text = title, style = BitwardenTheme.typography.titleSmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) Spacer(modifier = Modifier.height(4.dp)) Text( text = description, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt index ea259fa16b..c9cee320f6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -98,7 +97,7 @@ private fun RemovePasswordScreenContent( Text( text = state.description(), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .standardHorizontalMargin() .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt index 03fbf2ab78..d146c94aae 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -25,6 +24,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -122,7 +122,7 @@ private fun SetPasswordScreenContent( id = R.string.your_organization_requires_you_to_set_a_master_password, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -132,6 +132,7 @@ private fun SetPasswordScreenContent( BitwardenPolicyWarningText( text = stringResource(id = R.string.reset_password_auto_enroll_invite_warning), + textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, modifier = Modifier .padding(horizontal = 16.dp) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt index 946d2721d7..32c6b2ea67 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt @@ -21,7 +21,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.ClickableText import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -73,6 +72,7 @@ import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState import com.x8bit.bitwarden.ui.platform.components.dropdown.EnvironmentSelector import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold +import com.x8bit.bitwarden.ui.platform.components.toggle.color.bitwardenSwitchColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.composition.LocalIntentManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager @@ -267,7 +267,7 @@ private fun StartRegistrationContent( vectorIconRes = R.drawable.ic_tooltip_small, contentDescription = stringResource(R.string.help_with_server_geolocations), onClick = handler.onServerGeologyHelpClick, - contentColor = MaterialTheme.colorScheme.primary, + contentColor = BitwardenTheme.colorScheme.icon.secondary, // Align with design but keep accessible touch target of IconButton. modifier = Modifier.offset(y = (-8f).dp, x = 16.dp), ) @@ -324,7 +324,7 @@ private fun TermsAndPrivacyText( append(strTermsAndPrivacy) addStyle( style = SpanStyle( - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, ), start = 0, @@ -332,7 +332,7 @@ private fun TermsAndPrivacyText( ) addStyle( style = SpanStyle( - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, fontWeight = FontWeight.Bold, ), @@ -341,7 +341,7 @@ private fun TermsAndPrivacyText( ) addStyle( style = SpanStyle( - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, fontWeight = FontWeight.Bold, ), @@ -423,6 +423,11 @@ private fun ReceiveMarketingEmailsSwitch( mainString = stringResource(id = R.string.get_emails_from_bitwarden_for_announcements_advices_and_research_opportunities_unsubscribe_any_time), highlights = listOf(unsubscribeString), tag = TAG_URL, + highlightStyle = SpanStyle( + color = BitwardenTheme.colorScheme.text.interaction, + fontSize = BitwardenTheme.typography.bodyMedium.fontSize, + fontWeight = FontWeight.Bold, + ), ) Row( horizontalArrangement = Arrangement.Start, @@ -443,7 +448,9 @@ private fun ReceiveMarketingEmailsSwitch( } .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onCheckedChange.invoke(!isChecked) }, ) .fillMaxWidth(), @@ -454,6 +461,7 @@ private fun ReceiveMarketingEmailsSwitch( .width(52.dp), checked = isChecked, onCheckedChange = null, + colors = bitwardenSwitchColors(), ) Spacer(modifier = Modifier.width(16.dp)) ClickableText( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt index 47059f3908..835398f050 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -186,7 +185,7 @@ private fun TrustedDeviceScaffold( state.environmentLabel, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .testTag("LoggingInAsLabel") .padding(horizontal = 16.dp) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt index 90edb680cc..03f3861024 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -225,7 +224,7 @@ private fun TwoFactorLoginScreenContent( text = state.authMethod.description(state.displayEmail)(), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt index 6fde2e6277..7cda8433a4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -240,7 +239,7 @@ fun VaultUnlockScreen( Text( text = state.vaultUnlockType.unlockScreenMessage(), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -254,7 +253,7 @@ fun VaultUnlockScreen( state.environmentUrl, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .testTag("UserAndEnvironmentDataLabel") .padding(horizontal = 16.dp) @@ -277,7 +276,7 @@ fun VaultUnlockScreen( text = stringResource(R.string.account_biometric_invalidated), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.error, + color = BitwardenTheme.colorScheme.status.error, modifier = Modifier.padding(horizontal = 16.dp), ) Spacer(modifier = Modifier.height(12.dp)) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/welcome/WelcomeScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/welcome/WelcomeScreen.kt index 96419a597e..14c9b77942 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/welcome/WelcomeScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/welcome/WelcomeScreen.kt @@ -22,7 +22,6 @@ import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -78,6 +77,8 @@ fun WelcomeScreen( BitwardenScaffold( modifier = Modifier.fillMaxSize(), + containerColor = BitwardenTheme.colorScheme.background.secondary, + contentColor = BitwardenTheme.colorScheme.text.secondary, ) { innerPadding -> WelcomeScreenContent( state = state, @@ -191,7 +192,7 @@ private fun WelcomeCardLandscape( text = stringResource(id = state.titleRes), textAlign = TextAlign.Center, style = BitwardenTheme.typography.headlineMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.padding(bottom = 16.dp), ) @@ -199,7 +200,7 @@ private fun WelcomeCardLandscape( text = stringResource(id = state.messageRes), textAlign = TextAlign.Center, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) } } @@ -224,7 +225,7 @@ private fun WelcomeCardPortrait( text = stringResource(id = state.titleRes), textAlign = TextAlign.Center, style = BitwardenTheme.typography.headlineMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding( top = 48.dp, @@ -236,7 +237,7 @@ private fun WelcomeCardPortrait( text = stringResource(id = state.messageRes), textAlign = TextAlign.Center, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) } } @@ -255,11 +256,9 @@ private fun IndicatorDots( ) { items(totalCount) { index -> val color = animateColorAsState( - targetValue = if (index == selectedIndexProvider()) { - MaterialTheme.colorScheme.onSurface - } else { - MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f) - }, + targetValue = BitwardenTheme.colorScheme.text.primary.copy( + alpha = if (index == selectedIndexProvider()) 1.0f else 0.3f, + ), label = "dotColor", ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViews.kt b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViews.kt index 8d30a279a5..10af83bae5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViews.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViews.kt @@ -3,11 +3,16 @@ package com.x8bit.bitwarden.ui.autofill import android.content.Context import android.widget.RemoteViews import androidx.annotation.DrawableRes +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.autofill.model.AutofillAppInfo import com.x8bit.bitwarden.data.autofill.model.AutofillCipher import com.x8bit.bitwarden.ui.autofill.util.getAutofillSuggestionContentDescription import com.x8bit.bitwarden.ui.autofill.util.isSystemDarkMode +import com.x8bit.bitwarden.ui.platform.theme.color.BitwardenColorScheme +import com.x8bit.bitwarden.ui.platform.theme.color.darkBitwardenColorScheme +import com.x8bit.bitwarden.ui.platform.theme.color.lightBitwardenColorScheme /** * Build [RemoteViews] for representing an autofill suggestion. @@ -85,37 +90,31 @@ private fun buildAutofillRemoteViews( setInt( R.id.container, "setBackgroundColor", - autofillAppInfo.context.surface, + autofillAppInfo.context.background.toArgb(), ) setInt( R.id.title, "setTextColor", - autofillAppInfo.context.onSurface, + autofillAppInfo.context.primaryText.toArgb(), ) setInt( R.id.subtitle, "setTextColor", - autofillAppInfo.context.onSurfaceVariant, + autofillAppInfo.context.secondaryText.toArgb(), ) if (shouldTintIcon) { setInt( R.id.icon, "setColorFilter", - autofillAppInfo.context.onSurface, + autofillAppInfo.context.iconTint.toArgb(), ) } } -private val Context.onSurface: Int - get() = getColor( - if (isSystemDarkMode) R.color.dark_on_surface else R.color.on_surface, - ) -private val Context.onSurfaceVariant: Int - get() = getColor( - if (isSystemDarkMode) R.color.dark_on_surface_variant else R.color.on_surface_variant, - ) +private val Context.bitwardenColorScheme: BitwardenColorScheme + get() = if (isSystemDarkMode) darkBitwardenColorScheme else lightBitwardenColorScheme -private val Context.surface: Int - get() = getColor( - if (isSystemDarkMode) R.color.dark_surface else R.color.surface, - ) +val Context.iconTint: Color get() = bitwardenColorScheme.icon.primary +private val Context.primaryText: Color get() = bitwardenColorScheme.text.primary +private val Context.secondaryText: Color get() = bitwardenColorScheme.text.secondary +private val Context.background: Color get() = bitwardenColorScheme.background.primary diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensions.kt index c3735615fe..178d396fb9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensions.kt @@ -12,9 +12,11 @@ import androidx.annotation.DrawableRes import androidx.annotation.RequiresApi import androidx.autofill.inline.UiVersions import androidx.autofill.inline.v1.InlineSuggestionUi +import androidx.compose.ui.graphics.toArgb import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.autofill.model.AutofillAppInfo import com.x8bit.bitwarden.data.autofill.model.AutofillCipher +import com.x8bit.bitwarden.ui.autofill.iconTint /** * Try creating an [InlinePresentation] for [autofillCipher] with this [InlinePresentationSpec]. If @@ -91,7 +93,7 @@ private fun InlinePresentationSpec.createInlinePresentationOrNull( ) .run { if (shouldTintIcon) { - setTint(autofillAppInfo.contentColor) + setTint(autofillAppInfo.context.iconTint.toArgb()) } else { // Remove tinting setTintBlendMode(BlendMode.DST) @@ -121,17 +123,3 @@ private fun InlinePresentationSpec.createInlinePresentationOrNull( false, ) } - -/** - * Get the content color for the inline presentation. - */ -private val AutofillAppInfo.contentColor: Int - get() { - val colorRes = if (context.isSystemDarkMode) { - R.color.dark_on_surface - } else { - R.color.on_surface - } - - return context.getColor(colorRes) - } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ColorExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ColorExtensions.kt index a592175f9d..d8b6931d95 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ColorExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ColorExtensions.kt @@ -1,10 +1,10 @@ package com.x8bit.bitwarden.ui.platform.base.util -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.luminance +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A fractional luminance value beyond which we will consider the associated color to be light @@ -37,8 +37,8 @@ private val Color.luminanceWcag1: Float */ @Composable fun Color.toSafeOverlayColor(): Color { - val surfaceColor = MaterialTheme.colorScheme.surface - val onSurfaceColor = MaterialTheme.colorScheme.onSurface + val surfaceColor = BitwardenTheme.colorScheme.background.primary + val onSurfaceColor = BitwardenTheme.colorScheme.text.primary val lightColor: Color val darkColor: Color if (surfaceColor.luminance() > onSurfaceColor.luminance()) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ModifierExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ModifierExtensions.kt index 7c80940972..06af593dfa 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ModifierExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/ModifierExtensions.kt @@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.platform.base.util import androidx.compose.foundation.layout.padding import androidx.compose.material3.DividerDefaults import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable @@ -28,6 +27,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.util.isPortrait /** @@ -41,8 +41,8 @@ import com.x8bit.bitwarden.ui.platform.util.isPortrait fun Modifier.scrolledContainerBackground( topAppBarScrollBehavior: TopAppBarScrollBehavior, ): Modifier { - val expandedColor = MaterialTheme.colorScheme.surface - val collapsedColor = MaterialTheme.colorScheme.surfaceContainer + val expandedColor = BitwardenTheme.colorScheme.background.secondary + val collapsedColor = BitwardenTheme.colorScheme.background.secondary return CombinedModifier( outer = this, inner = drawBehind { @@ -66,7 +66,7 @@ fun Modifier.bottomDivider( paddingStart: Dp = 0.dp, paddingEnd: Dp = 0.dp, thickness: Dp = DividerDefaults.Thickness, - color: Color = DividerDefaults.color, + color: Color = BitwardenTheme.colorScheme.stroke.divider, enabled: Boolean = true, ): Modifier = drawWithCache { onDrawWithContent { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt index 710a249399..5eb97f78a4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt @@ -4,7 +4,6 @@ import android.content.res.Resources import android.os.Parcelable import androidx.annotation.PluralsRes import androidx.annotation.StringRes -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.ui.platform.LocalContext @@ -135,7 +134,7 @@ fun createAnnotatedString( mainString: String, highlights: List, highlightStyle: SpanStyle = SpanStyle( - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, fontWeight = FontWeight.Bold, ), @@ -145,7 +144,7 @@ fun createAnnotatedString( append(mainString) addStyle( style = SpanStyle( - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, fontSize = BitwardenTheme.typography.bodyMedium.fontSize, ), start = 0, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountActionItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountActionItem.kt index 498607cb6e..766cdc384e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountActionItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountActionItem.kt @@ -7,7 +7,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.testTag -import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font @@ -18,7 +17,9 @@ import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.toSafeOverlayColor import com.x8bit.bitwarden.ui.platform.base.util.toUnscaledTextUnit +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenStandardIconButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * Displays an icon representing a Bitwarden account with the user's initials superimposed. @@ -39,6 +40,7 @@ fun BitwardenAccountActionItem( IconButton( onClick = onClick, + colors = bitwardenStandardIconButtonColors(), modifier = Modifier.testTag("CurrentActiveAccount"), ) { Icon( @@ -62,12 +64,11 @@ fun BitwardenAccountActionItem( @Preview(showBackground = true) @Composable private fun BitwardenAccountActionItem_preview() { - val mockInitials = "BW" - val mockColor = colorResource(id = R.color.primary) - - BitwardenAccountActionItem( - initials = mockInitials, - color = mockColor, - onClick = {}, - ) + BitwardenTheme { + BitwardenAccountActionItem( + initials = "BW", + color = BitwardenTheme.colorScheme.icon.primary, + onClick = {}, + ) + } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountSwitcher.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountSwitcher.kt index ce1f1c33b8..146040debf 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountSwitcher.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenAccountSwitcher.kt @@ -23,7 +23,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior @@ -274,7 +273,9 @@ private fun AccountSummaryItem( .testTag("AccountCell") .combinedClickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onSwitchAccountClick(accountSummary) }, onLongClick = { onSwitchAccountLongClick(accountSummary) }, ) @@ -317,7 +318,7 @@ private fun AccountSummaryItem( Text( text = accountSummary.environmentLabel, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.testTag("AccountEnvironmentLabel"), ) @@ -325,7 +326,7 @@ private fun AccountSummaryItem( Text( text = stringResource(id = supportingTextResId).lowercaseWithCurrentLocal(), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.testTag("AccountStatusLabel"), ) } @@ -336,7 +337,10 @@ private fun AccountSummaryItem( Icon( painter = rememberVectorPainter(id = accountSummary.iconRes), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = when (accountSummary.status) { + AccountSummary.Status.ACTIVE -> BitwardenTheme.colorScheme.icon.secondary + else -> BitwardenTheme.colorScheme.icon.primary + }, modifier = Modifier .testTag(accountSummary.iconTestTag) .size(24.dp), @@ -396,7 +400,9 @@ private fun AddAccountItem( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .padding(vertical = 8.dp) @@ -405,7 +411,7 @@ private fun AddAccountItem( Icon( painter = rememberVectorPainter(id = R.drawable.ic_plus), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.secondary, modifier = Modifier .padding(vertical = 8.dp) .size(24.dp), @@ -416,6 +422,7 @@ private fun AddAccountItem( Text( text = stringResource(id = R.string.add_account), style = BitwardenTheme.typography.bodyLarge, + color = BitwardenTheme.colorScheme.text.interaction, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenPlaceholderAccountItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenPlaceholderAccountItem.kt index 9c6fa75be4..c4d056fdd2 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenPlaceholderAccountItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/account/BitwardenPlaceholderAccountItem.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.account import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -10,6 +9,7 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTag import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenStandardIconButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.feature.settings.appearance.model.AppTheme import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -25,18 +25,19 @@ fun BitwardenPlaceholderAccountActionItem( ) { IconButton( onClick = onClick, + colors = bitwardenStandardIconButtonColors(), modifier = Modifier .semantics(mergeDescendants = true) { testTag = "CurrentActiveAccount" }, ) { Icon( painter = rememberVectorPainter(id = R.drawable.ic_account_initials_container), contentDescription = null, - tint = MaterialTheme.colorScheme.secondaryContainer, + tint = BitwardenTheme.colorScheme.background.tertiary, ) Icon( painter = rememberVectorPainter(id = R.drawable.ic_dots), contentDescription = stringResource(id = R.string.account), - tint = MaterialTheme.colorScheme.onSecondaryContainer, + tint = BitwardenTheme.colorScheme.text.interaction, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenMediumTopAppBar.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenMediumTopAppBar.kt index 3269d33817..708cfed84b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenMediumTopAppBar.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenMediumTopAppBar.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.appbar.color.bitwardenTopAppBarColors import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -40,13 +41,7 @@ fun BitwardenMediumTopAppBar( actions: @Composable RowScope.() -> Unit = {}, ) { MediumTopAppBar( - colors = TopAppBarDefaults.largeTopAppBarColors( - containerColor = MaterialTheme.colorScheme.surface, - scrolledContainerColor = MaterialTheme.colorScheme.surfaceContainer, - navigationIconContentColor = MaterialTheme.colorScheme.onSurface, - titleContentColor = MaterialTheme.colorScheme.onSurface, - actionIconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTopAppBarColors(), scrollBehavior = scrollBehavior, title = { Text( @@ -76,7 +71,6 @@ private fun BitwardenMediumTopAppBar_preview() { vectorIconRes = R.drawable.ic_more, contentDescription = "", onClick = { }, - contentColor = MaterialTheme.colorScheme.onSurface, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenSearchTopAppBar.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenSearchTopAppBar.kt index 0b53e3e2b8..46a5982e53 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenSearchTopAppBar.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenSearchTopAppBar.kt @@ -3,12 +3,9 @@ package com.x8bit.bitwarden.ui.platform.components.appbar import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextField -import androidx.compose.material3.TextFieldDefaults import androidx.compose.material3.TopAppBar -import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -23,7 +20,9 @@ import androidx.compose.ui.text.input.ImeAction import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.mirrorIfRtl import com.x8bit.bitwarden.ui.platform.base.util.tabNavigation +import com.x8bit.bitwarden.ui.platform.components.appbar.color.bitwardenTopAppBarColors import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -47,13 +46,7 @@ fun BitwardenSearchTopAppBar( val focusRequester = remember { FocusRequester() } TopAppBar( modifier = modifier.testTag("HeaderBarComponent"), - colors = TopAppBarDefaults.topAppBarColors( - containerColor = MaterialTheme.colorScheme.surface, - scrolledContainerColor = MaterialTheme.colorScheme.surfaceContainer, - navigationIconContentColor = MaterialTheme.colorScheme.onSurface, - titleContentColor = MaterialTheme.colorScheme.onSurface, - actionIconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTopAppBarColors(), scrollBehavior = scrollBehavior, navigationIcon = { navigationIcon?.let { @@ -69,11 +62,9 @@ fun BitwardenSearchTopAppBar( }, title = { TextField( - colors = TextFieldDefaults.colors( - focusedContainerColor = Color.Transparent, - unfocusedContainerColor = Color.Transparent, - focusedIndicatorColor = Color.Transparent, - unfocusedIndicatorColor = Color.Transparent, + colors = bitwardenTextFieldColors( + focusedBorderColor = Color.Transparent, + unfocusedBorderColor = Color.Transparent, ), textStyle = BitwardenTheme.typography.bodyLarge, placeholder = { Text(text = placeholder) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenTopAppBar.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenTopAppBar.kt index a054c8a5c0..56e29131b4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenTopAppBar.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/BitwardenTopAppBar.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.appbar import androidx.compose.foundation.layout.RowScope import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MediumTopAppBar import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar @@ -22,6 +21,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.mirrorIfRtl +import com.x8bit.bitwarden.ui.platform.components.appbar.color.bitwardenTopAppBarColors import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -101,17 +101,9 @@ fun BitwardenTopAppBar( } } - val topAppBarColors = TopAppBarDefaults.largeTopAppBarColors( - containerColor = MaterialTheme.colorScheme.surface, - scrolledContainerColor = MaterialTheme.colorScheme.surfaceContainer, - navigationIconContentColor = MaterialTheme.colorScheme.onSurface, - titleContentColor = MaterialTheme.colorScheme.onSurface, - actionIconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, - ) - if (titleTextHasOverflow) { MediumTopAppBar( - colors = topAppBarColors, + colors = bitwardenTopAppBarColors(), scrollBehavior = scrollBehavior, navigationIcon = navigationIconContent, title = { @@ -129,7 +121,7 @@ fun BitwardenTopAppBar( ) } else { TopAppBar( - colors = topAppBarColors, + colors = bitwardenTopAppBarColors(), scrollBehavior = scrollBehavior, navigationIcon = navigationIconContent, title = { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt index 22894005ff..f2d05a17e1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt @@ -1,12 +1,10 @@ package com.x8bit.bitwarden.ui.platform.components.appbar.action -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.widthIn import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -25,6 +23,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.DpOffset import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.appbar.color.bitwardenMenuItemColors import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import kotlinx.collections.immutable.ImmutableList @@ -62,13 +61,13 @@ fun BitwardenOverflowActionItem( expanded = isOverflowMenuVisible, onDismissRequest = { isOverflowMenuVisible = false }, offset = DpOffset(x = (-12).dp, y = 0.dp), + containerColor = BitwardenTheme.colorScheme.background.primary, modifier = Modifier .semantics { testTagsAsResourceId = true } .widthIn( min = 112.dp, max = 280.dp, - ) - .background(MaterialTheme.colorScheme.surfaceContainer), + ), content = { menuItemDataList.forEach { dropdownMenuItemData -> DropdownMenuItem( @@ -77,6 +76,7 @@ fun BitwardenOverflowActionItem( testTag = it } }, + colors = bitwardenMenuItemColors(), text = { Text( text = dropdownMenuItemData.text, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenMenuItemColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenMenuItemColors.kt new file mode 100644 index 0000000000..38fafb898f --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenMenuItemColors.kt @@ -0,0 +1,18 @@ +package com.x8bit.bitwarden.ui.platform.components.appbar.color + +import androidx.compose.material3.MenuItemColors +import androidx.compose.runtime.Composable +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for menu items. + */ +@Composable +fun bitwardenMenuItemColors(): MenuItemColors = MenuItemColors( + textColor = BitwardenTheme.colorScheme.text.primary, + leadingIconColor = BitwardenTheme.colorScheme.icon.primary, + trailingIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledTextColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledLeadingIconColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledTrailingIconColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenTopAppBarColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenTopAppBarColors.kt new file mode 100644 index 0000000000..71cd1d2b5a --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/color/BitwardenTopAppBarColors.kt @@ -0,0 +1,19 @@ +package com.x8bit.bitwarden.ui.platform.components.appbar.color + +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.TopAppBarColors +import androidx.compose.runtime.Composable +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for top app bars. + */ +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun bitwardenTopAppBarColors(): TopAppBarColors = TopAppBarColors( + containerColor = BitwardenTheme.colorScheme.background.secondary, + scrolledContainerColor = BitwardenTheme.colorScheme.background.secondary, + navigationIconContentColor = BitwardenTheme.colorScheme.icon.primary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + actionIconContentColor = BitwardenTheme.colorScheme.icon.primary, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/badge/NotificationBadge.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/badge/NotificationBadge.kt index 6e6a0063db..cb8ad68f31 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/badge/NotificationBadge.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/badge/NotificationBadge.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.material3.Badge -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -18,7 +17,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors /** * Reusable component for displaying a notification badge. @@ -30,8 +28,8 @@ fun NotificationBadge( notificationCount: Int, modifier: Modifier = Modifier, isVisible: Boolean = true, - backgroundColor: Color = LocalNonMaterialColors.current.fingerprint, - contentColor: Color = MaterialTheme.colorScheme.onSecondary, + backgroundColor: Color = BitwardenTheme.colorScheme.icon.badgeBackground, + contentColor: Color = BitwardenTheme.colorScheme.icon.badgeForeground, ) { AnimatedVisibility( visible = isVisible, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButton.kt index 57a3d2b960..4440de530b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButton.kt @@ -2,13 +2,13 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -34,7 +34,7 @@ fun BitwardenFilledButton( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.buttonColors(), + colors = bitwardenFilledButtonColors(), ) { Text( text = label, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButtonWithIcon.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButtonWithIcon.kt index 4c92aed3de..20baab60f0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButtonWithIcon.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledButtonWithIcon.kt @@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -13,6 +12,7 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -42,7 +42,7 @@ fun BitwardenFilledButtonWithIcon( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.buttonColors(), + colors = bitwardenFilledButtonColors(), ) { Icon( painter = icon, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledErrorButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledErrorButton.kt index 62f92cfc4d..49ae040316 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledErrorButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledErrorButton.kt @@ -2,14 +2,13 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledErrorButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -35,10 +34,7 @@ fun BitwardenFilledErrorButton( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.buttonColors( - containerColor = MaterialTheme.colorScheme.error, - contentColor = MaterialTheme.colorScheme.onError, - ), + colors = bitwardenFilledErrorButtonColors(), ) { Text( text = label, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledIconButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledIconButton.kt index d011c0d4fb..3b16f627f6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledIconButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledIconButton.kt @@ -3,13 +3,12 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.annotation.DrawableRes import androidx.compose.material3.FilledIconButton import androidx.compose.material3.Icon -import androidx.compose.material3.IconButtonDefaults -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledIconButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -33,12 +32,7 @@ fun BitwardenFilledIconButton( FilledIconButton( modifier = modifier.semantics(mergeDescendants = true) {}, onClick = onClick, - colors = IconButtonDefaults.filledIconButtonColors( - containerColor = MaterialTheme.colorScheme.secondaryContainer, - contentColor = MaterialTheme.colorScheme.onSecondaryContainer, - disabledContainerColor = MaterialTheme.colorScheme.onSurface.copy(alpha = .12f), - disabledContentColor = MaterialTheme.colorScheme.onSecondaryContainer, - ), + colors = bitwardenFilledIconButtonColors(), enabled = isEnabled, ) { Icon( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButton.kt index aacf70d54d..3a8b1e87f3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButton.kt @@ -3,21 +3,17 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledTonalButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A filled tonal button for the Bitwarden UI with a customized appearance. * - * This button uses the `secondaryContainer` color from the current [MaterialTheme.colorScheme] - * for its background and the `onSecondaryContainer` color for its label text. - * * @param label The text to be displayed on the button. * @param onClick A lambda which will be invoked when the button is clicked. * @param isEnabled Whether or not the button is enabled. @@ -38,7 +34,7 @@ fun BitwardenFilledTonalButton( horizontal = 24.dp, ), enabled = isEnabled, - colors = ButtonDefaults.filledTonalButtonColors(), + colors = bitwardenFilledTonalButtonColors(), modifier = modifier, ) { Text( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButtonWithIcon.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButtonWithIcon.kt index 72b97ebf5d..6549f81052 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButtonWithIcon.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenFilledTonalButtonWithIcon.kt @@ -3,9 +3,7 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -13,15 +11,13 @@ import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenFilledTonalButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A filled tonal button for the Bitwarden UI with a customized appearance and an icon. * - * This button uses the `secondaryContainer` color from the current [MaterialTheme.colorScheme] - * for its background and the `onSecondaryContainer` color for its label text. - * * @param label The text to be displayed on the button. * @param icon The icon for the button. * @param onClick A lambda which will be invoked when the button is clicked. @@ -43,7 +39,7 @@ fun BitwardenFilledTonalButtonWithIcon( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.filledTonalButtonColors(), + colors = bitwardenFilledTonalButtonColors(), modifier = modifier, enabled = isEnabled, ) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButton.kt index 099be62966..4bcbe02aa8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButton.kt @@ -1,7 +1,7 @@ package com.x8bit.bitwarden.ui.platform.components.button +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -9,6 +9,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenOutlinedButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -35,7 +36,15 @@ fun BitwardenOutlinedButton( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.outlinedButtonColors(), + colors = bitwardenOutlinedButtonColors(), + border = BorderStroke( + width = 1.dp, + color = if (isEnabled) { + BitwardenTheme.colorScheme.outlineButton.border + } else { + BitwardenTheme.colorScheme.outlineButton.borderDisabled + }, + ), ) { Text( text = label, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButtonWithIcon.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButtonWithIcon.kt index 57b0f1db50..b65856d7d8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButtonWithIcon.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedButtonWithIcon.kt @@ -1,8 +1,8 @@ package com.x8bit.bitwarden.ui.platform.components.button +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text @@ -13,6 +13,7 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenOutlinedButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -42,7 +43,15 @@ fun BitwardenOutlinedButtonWithIcon( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.outlinedButtonColors(), + colors = bitwardenOutlinedButtonColors(), + border = BorderStroke( + width = 1.dp, + color = if (isEnabled) { + BitwardenTheme.colorScheme.outlineButton.border + } else { + BitwardenTheme.colorScheme.outlineButton.borderDisabled + }, + ), ) { Icon( painter = icon, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedErrorButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedErrorButton.kt index 926bf9b240..c5cbea2c75 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedErrorButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenOutlinedErrorButton.kt @@ -2,8 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -11,6 +9,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenOutlinedErrorButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -36,12 +35,10 @@ fun BitwardenOutlinedErrorButton( vertical = 10.dp, horizontal = 24.dp, ), - colors = ButtonDefaults.outlinedButtonColors( - contentColor = MaterialTheme.colorScheme.error, - ), + colors = bitwardenOutlinedErrorButtonColors(), border = BorderStroke( width = 1.dp, - color = MaterialTheme.colorScheme.error.copy( + color = BitwardenTheme.colorScheme.status.error.copy( alpha = if (isEnabled) 1f else 0.12f, ), ), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenStandardIconButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenStandardIconButton.kt index 6e2aef34c1..35c66db245 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenStandardIconButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenStandardIconButton.kt @@ -3,8 +3,6 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.annotation.DrawableRes import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.IconButtonDefaults -import androidx.compose.material3.LocalContentColor import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -12,6 +10,7 @@ import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenStandardIconButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -31,7 +30,7 @@ fun BitwardenStandardIconButton( onClick: () -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, - contentColor: Color = LocalContentColor.current, + contentColor: Color = BitwardenTheme.colorScheme.icon.primary, ) { BitwardenStandardIconButton( painter = rememberVectorPainter(id = vectorIconRes), @@ -59,14 +58,12 @@ fun BitwardenStandardIconButton( onClick: () -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, - contentColor: Color = LocalContentColor.current, + contentColor: Color = BitwardenTheme.colorScheme.icon.primary, ) { IconButton( modifier = modifier.semantics(mergeDescendants = true) {}, onClick = onClick, - colors = IconButtonDefaults.iconButtonColors( - contentColor = contentColor, - ), + colors = bitwardenStandardIconButtonColors(contentColor = contentColor), enabled = isEnabled, ) { Icon( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenTextButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenTextButton.kt index 402d674af8..496830db88 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenTextButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/BitwardenTextButton.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.platform.components.button import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -9,6 +8,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.button.color.bitwardenTextButtonColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -25,16 +25,8 @@ fun BitwardenTextButton( onClick: () -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, - labelTextColor: Color? = null, + labelTextColor: Color = BitwardenTheme.colorScheme.outlineButton.foreground, ) { - val defaultColors = if (labelTextColor != null) { - ButtonDefaults.textButtonColors( - contentColor = labelTextColor, - ) - } else { - ButtonDefaults.textButtonColors() - } - TextButton( onClick = onClick, modifier = modifier, @@ -43,7 +35,7 @@ fun BitwardenTextButton( vertical = 10.dp, horizontal = 24.dp, ), - colors = defaultColors, + colors = bitwardenTextButtonColors(contentColor = labelTextColor), ) { Text( text = label, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenButtonColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenButtonColors.kt new file mode 100644 index 0000000000..71576fd79e --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenButtonColors.kt @@ -0,0 +1,74 @@ +package com.x8bit.bitwarden.ui.platform.components.button.color + +import androidx.compose.material3.ButtonColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for a filled button. + */ +@Composable +fun bitwardenFilledButtonColors(): ButtonColors = ButtonColors( + containerColor = BitwardenTheme.colorScheme.filledButton.background, + contentColor = BitwardenTheme.colorScheme.filledButton.foreground, + disabledContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for a filled error button. + */ +@Composable +fun bitwardenFilledErrorButtonColors() = ButtonColors( + containerColor = BitwardenTheme.colorScheme.status.weak1, + contentColor = BitwardenTheme.colorScheme.filledButton.foreground, + disabledContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for a tonal button. + */ +@Composable +fun bitwardenFilledTonalButtonColors(): ButtonColors = ButtonColors( + containerColor = BitwardenTheme.colorScheme.tonalButton.background, + contentColor = BitwardenTheme.colorScheme.tonalButton.foreground, + disabledContainerColor = BitwardenTheme.colorScheme.tonalButton.backgroundDisabled, + disabledContentColor = BitwardenTheme.colorScheme.tonalButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for an outlined button. + */ +@Composable +fun bitwardenOutlinedButtonColors(): ButtonColors = ButtonColors( + containerColor = Color.Transparent, + contentColor = BitwardenTheme.colorScheme.outlineButton.foreground, + disabledContainerColor = Color.Transparent, + disabledContentColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for an outlined error button. + */ +@Composable +fun bitwardenOutlinedErrorButtonColors(): ButtonColors = ButtonColors( + containerColor = Color.Transparent, + contentColor = BitwardenTheme.colorScheme.status.error, + disabledContainerColor = Color.Transparent, + disabledContentColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for a text button. + */ +@Composable +fun bitwardenTextButtonColors( + contentColor: Color = BitwardenTheme.colorScheme.outlineButton.foreground, +): ButtonColors = ButtonColors( + containerColor = Color.Transparent, + contentColor = contentColor, + disabledContainerColor = Color.Transparent, + disabledContentColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenIconButtonColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenIconButtonColors.kt new file mode 100644 index 0000000000..c13ec0e9b9 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/button/color/BitwardenIconButtonColors.kt @@ -0,0 +1,30 @@ +package com.x8bit.bitwarden.ui.platform.components.button.color + +import androidx.compose.material3.IconButtonColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for a filled icon button. + */ +@Composable +fun bitwardenFilledIconButtonColors(): IconButtonColors = IconButtonColors( + containerColor = BitwardenTheme.colorScheme.background.tertiary, + contentColor = BitwardenTheme.colorScheme.filledButton.foregroundReversed, + disabledContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) + +/** + * Provides a default set of Bitwarden-styled colors for a standard icon button. + */ +@Composable +fun bitwardenStandardIconButtonColors( + contentColor: Color = BitwardenTheme.colorScheme.icon.primary, +): IconButtonColors = IconButtonColors( + containerColor = Color.Transparent, + contentColor = contentColor, + disabledContainerColor = Color.Transparent, + disabledContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt index 3029d80703..d470dbbc25 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt @@ -24,6 +24,7 @@ import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.badge.NotificationBadge import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton +import com.x8bit.bitwarden.ui.platform.components.card.color.bitwardenCardColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -50,9 +51,7 @@ fun BitwardenActionCard( Card( modifier = modifier, shape = RoundedCornerShape(12.dp), - colors = CardDefaults.cardColors( - containerColor = BitwardenTheme.colorScheme.background.tertiary, - ), + colors = bitwardenCardColors(), elevation = CardDefaults.elevatedCardElevation(), border = BorderStroke(width = 1.dp, color = BitwardenTheme.colorScheme.stroke.border), ) { @@ -77,13 +76,12 @@ fun BitwardenActionCard( painter = rememberVectorPainter(id = R.drawable.ic_close), contentDescription = stringResource(id = R.string.close), onClick = onDismissClick, - contentColor = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier.offset(x = 8.dp), ) } Spacer(Modifier.height(16.dp)) BitwardenFilledButton( - actionText, + label = actionText, onClick = onActionClick, modifier = Modifier.fillMaxWidth(), ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt index f207c417ba..bb705a934d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt @@ -1,5 +1,6 @@ package com.x8bit.bitwarden.ui.platform.components.card +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column @@ -14,7 +15,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -23,6 +23,7 @@ import androidx.compose.ui.graphics.vector.VectorPainter import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.card.color.bitwardenCardColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -40,12 +41,11 @@ fun BitwardenActionCardSmall( ) { Card( onClick = onCardClicked, - shape = RoundedCornerShape(size = 16.dp), + shape = RoundedCornerShape(size = 12.dp), modifier = modifier, - colors = CardDefaults.cardColors( - containerColor = BitwardenTheme.colorScheme.background.tertiary, - ), + colors = bitwardenCardColors(), elevation = CardDefaults.elevatedCardElevation(), + border = BorderStroke(width = 1.dp, color = BitwardenTheme.colorScheme.stroke.border), ) { Row( modifier = Modifier @@ -111,7 +111,7 @@ private fun ActionCardSmallWithTrailingIcon_preview() { Icon( painter = rememberVectorPainter(id = R.drawable.ic_navigate_next), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/color/BitwardenCardColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/color/BitwardenCardColors.kt new file mode 100644 index 0000000000..05e9995995 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/color/BitwardenCardColors.kt @@ -0,0 +1,16 @@ +package com.x8bit.bitwarden.ui.platform.components.card.color + +import androidx.compose.material3.CardColors +import androidx.compose.runtime.Composable +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for a card. + */ +@Composable +fun bitwardenCardColors(): CardColors = CardColors( + containerColor = BitwardenTheme.colorScheme.background.tertiary, + contentColor = BitwardenTheme.colorScheme.text.primary, + disabledContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/content/BitwardenErrorContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/content/BitwardenErrorContent.kt index edfb696299..e2d065e128 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/content/BitwardenErrorContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/content/BitwardenErrorContent.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -38,7 +37,7 @@ fun BitwardenErrorContent( Spacer(modifier = Modifier.weight(1f)) Text( text = message, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, textAlign = TextAlign.Center, modifier = Modifier diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt index 244a3f51ea..0d56bc5765 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import android.os.Parcelable import androidx.compose.material3.AlertDialog -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.ExperimentalComposeUiApi @@ -60,7 +59,10 @@ fun BitwardenBasicDialog( modifier = Modifier.testTag("AlertContentText"), ) }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "AlertPopup" diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt index b7e456a4a6..1948ed40f6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt @@ -3,14 +3,12 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.material3.DatePicker +import androidx.compose.material3.DatePickerColors import androidx.compose.material3.DatePickerDialog import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text -import androidx.compose.material3.TextButton import androidx.compose.material3.rememberDatePickerState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -30,6 +28,9 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTag import androidx.compose.ui.semantics.testTagsAsResourceId import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldButtonColors +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.util.orNow @@ -93,18 +94,10 @@ fun BitwardenDateSelectButton( Icon( painter = rememberVectorPainter(id = R.drawable.ic_region_select_dropdown), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, ) }, - colors = OutlinedTextFieldDefaults.colors( - disabledTextColor = MaterialTheme.colorScheme.onSurface, - disabledBorderColor = MaterialTheme.colorScheme.outline, - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledSupportingTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTextFieldButtonColors(), ) if (shouldShowDialog) { @@ -112,9 +105,11 @@ fun BitwardenDateSelectButton( initialSelectedDateMillis = currentZonedDateTime.orNow().toInstant().toEpochMilli(), ) DatePickerDialog( + colors = bitwardenDatePickerColors(), onDismissRequest = { shouldShowDialog = false }, confirmButton = { - TextButton( + BitwardenTextButton( + label = stringResource(id = R.string.ok), onClick = { onDateSelect( ZonedDateTime @@ -128,31 +123,55 @@ fun BitwardenDateSelectButton( ) shouldShowDialog = false }, - modifier = Modifier.testTag("AcceptAlertButton"), - ) { - Text( - text = stringResource(id = R.string.ok), - style = BitwardenTheme.typography.labelLarge, - ) - } + modifier = Modifier.testTag(tag = "AcceptAlertButton"), + ) }, dismissButton = { - TextButton( + BitwardenTextButton( + label = stringResource(id = R.string.cancel), onClick = { shouldShowDialog = false }, - modifier = Modifier.testTag("DismissAlertButton"), - ) { - Text( - text = stringResource(id = R.string.cancel), - style = BitwardenTheme.typography.labelLarge, - ) - } + modifier = Modifier.testTag(tag = "DismissAlertButton"), + ) }, modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "AlertPopup" }, ) { - DatePicker(state = datePickerState) + DatePicker( + state = datePickerState, + colors = bitwardenDatePickerColors(), + ) } } } + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun bitwardenDatePickerColors(): DatePickerColors = DatePickerColors( + containerColor = BitwardenTheme.colorScheme.background.primary, + titleContentColor = BitwardenTheme.colorScheme.text.secondary, + headlineContentColor = BitwardenTheme.colorScheme.text.primary, + weekdayContentColor = BitwardenTheme.colorScheme.text.primary, + subheadContentColor = BitwardenTheme.colorScheme.text.secondary, + navigationContentColor = BitwardenTheme.colorScheme.icon.primary, + yearContentColor = BitwardenTheme.colorScheme.text.primary, + disabledYearContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + currentYearContentColor = BitwardenTheme.colorScheme.filledButton.foreground, + selectedYearContentColor = BitwardenTheme.colorScheme.filledButton.foreground, + disabledSelectedYearContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + selectedYearContainerColor = BitwardenTheme.colorScheme.filledButton.background, + disabledSelectedYearContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + dayContentColor = BitwardenTheme.colorScheme.text.primary, + disabledDayContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + selectedDayContentColor = BitwardenTheme.colorScheme.text.reversed, + disabledSelectedDayContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + selectedDayContainerColor = BitwardenTheme.colorScheme.filledButton.background, + disabledSelectedDayContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + todayContentColor = BitwardenTheme.colorScheme.outlineButton.foreground, + todayDateBorderColor = BitwardenTheme.colorScheme.outlineButton.border, + dayInSelectionRangeContainerColor = BitwardenTheme.colorScheme.filledButton.background, + dividerColor = BitwardenTheme.colorScheme.stroke.divider, + dayInSelectionRangeContentColor = BitwardenTheme.colorScheme.text.primary, + dateTextFieldColors = bitwardenTextFieldColors(), +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt index cd110f7be4..e4c8073342 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -52,7 +51,8 @@ fun BitwardenLoadingDialog( Card( shape = RoundedCornerShape(28.dp), colors = CardDefaults.cardColors( - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + contentColor = BitwardenTheme.colorScheme.text.primary, ), modifier = Modifier .semantics { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt index 1ad9c48aad..8ca8ac94ce 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.imePadding import androidx.compose.material3.AlertDialog -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -84,7 +83,10 @@ fun BitwardenMasterPasswordDialog( ) } }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "AlertPopup" diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt index d322b701d3..ee0f917689 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.foundation.layout.imePadding import androidx.compose.material3.AlertDialog -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -70,7 +69,10 @@ fun BitwardenPinDialog( autoFocus = true, ) }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "AlertPopup" diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt index 2e0c97f4e4..3bf0c282f8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt @@ -1,17 +1,14 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -28,6 +25,7 @@ import androidx.compose.ui.window.Dialog import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.dialog.row.BitwardenSelectionRow +import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider import com.x8bit.bitwarden.ui.platform.components.util.maxDialogHeight import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -63,7 +61,7 @@ fun BitwardenSelectionDialog( ) // This background is necessary for the dialog to not be transparent. .background( - color = MaterialTheme.colorScheme.surfaceContainerHigh, + color = BitwardenTheme.colorScheme.background.primary, shape = RoundedCornerShape(28.dp), ), horizontalAlignment = Alignment.End, @@ -74,16 +72,11 @@ fun BitwardenSelectionDialog( .padding(24.dp) .fillMaxWidth(), text = title, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.headlineSmall, ) if (scrollState.canScrollBackward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } Column( modifier = Modifier @@ -92,12 +85,7 @@ fun BitwardenSelectionDialog( content = selectionItems, ) if (scrollState.canScrollForward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } BitwardenTextButton( modifier = Modifier diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt index 029726e1d5..0de719360e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.material3.AlertDialog -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -86,7 +85,10 @@ fun BitwardenTextEntryDialog( }, ) }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "AlertPopup" diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt index 4e52bd2708..a62ba48a89 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt @@ -1,6 +1,5 @@ package com.x8bit.bitwarden.ui.platform.components.dialog -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.IntrinsicSize @@ -14,9 +13,9 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text -import androidx.compose.material3.TextButton import androidx.compose.material3.TimeInput import androidx.compose.material3.TimePicker +import androidx.compose.material3.TimePickerColors import androidx.compose.material3.rememberTimePickerState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -36,6 +35,7 @@ import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton +import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -67,26 +67,18 @@ fun BitwardenTimePickerDialog( TimePickerDialog( onDismissRequest = onDismissRequest, confirmButton = { - TextButton( + BitwardenTextButton( + modifier = Modifier.testTag(tag = "AcceptAlertButton"), + label = stringResource(id = R.string.ok), onClick = { onTimeSelect(timePickerState.hour, timePickerState.minute) }, - ) { - Text( - text = stringResource(id = R.string.ok), - style = BitwardenTheme.typography.labelLarge, - modifier = Modifier.testTag("AcceptAlertButton"), - ) - } + ) }, dismissButton = { - TextButton( + BitwardenTextButton( + modifier = Modifier.testTag(tag = "DismissAlertButton"), + label = stringResource(id = R.string.cancel), onClick = onDismissRequest, - modifier = Modifier.testTag("DismissAlertButton"), - ) { - Text( - text = stringResource(id = R.string.cancel), - style = BitwardenTheme.typography.labelLarge, - ) - } + ) }, inputToggleButton = { BitwardenStandardIconButton( @@ -96,7 +88,6 @@ fun BitwardenTimePickerDialog( id = androidx.compose.material3.R.string.m3c_date_picker_switch_to_input_mode, ), onClick = { showTimeInput = !showTimeInput }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, ) }, ) { @@ -104,17 +95,41 @@ fun BitwardenTimePickerDialog( if (showTimeInput) { TimeInput( state = timePickerState, + colors = bitwardenTimePickerColors(), modifier = modifier, ) } else { TimePicker( state = timePickerState, + colors = bitwardenTimePickerColors(), modifier = modifier, ) } } } +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun bitwardenTimePickerColors(): TimePickerColors = TimePickerColors( + clockDialColor = BitwardenTheme.colorScheme.filledButton.backgroundReversed, + selectorColor = BitwardenTheme.colorScheme.filledButton.background, + containerColor = BitwardenTheme.colorScheme.filledButton.foreground, + clockDialSelectedContentColor = BitwardenTheme.colorScheme.background.secondary, + clockDialUnselectedContentColor = BitwardenTheme.colorScheme.text.primary, + periodSelectorBorderColor = BitwardenTheme.colorScheme.stroke.divider, + periodSelectorSelectedContainerColor = BitwardenTheme + .colorScheme + .filledButton + .backgroundReversed, + periodSelectorUnselectedContainerColor = BitwardenTheme.colorScheme.background.primary, + periodSelectorSelectedContentColor = BitwardenTheme.colorScheme.filledButton.foregroundReversed, + periodSelectorUnselectedContentColor = BitwardenTheme.colorScheme.text.secondary, + timeSelectorSelectedContainerColor = BitwardenTheme.colorScheme.background.tertiary, + timeSelectorUnselectedContainerColor = BitwardenTheme.colorScheme.background.secondary, + timeSelectorSelectedContentColor = BitwardenTheme.colorScheme.text.primary, + timeSelectorUnselectedContentColor = BitwardenTheme.colorScheme.text.primary, +) + @OptIn(ExperimentalComposeUiApi::class) @Composable private fun TimePickerDialog( @@ -130,18 +145,15 @@ private fun TimePickerDialog( ) { Surface( shape = MaterialTheme.shapes.extraLarge, - tonalElevation = 6.dp, + color = BitwardenTheme.colorScheme.background.primary, + contentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .semantics { testTagsAsResourceId = true testTag = "AlertPopup" } .width(IntrinsicSize.Min) - .height(IntrinsicSize.Min) - .background( - shape = MaterialTheme.shapes.extraLarge, - color = MaterialTheme.colorScheme.surface, - ), + .height(IntrinsicSize.Min), ) { Column( modifier = Modifier.padding(24.dp), @@ -154,6 +166,7 @@ private fun TimePickerDialog( .padding(bottom = 20.dp), // TODO: This should be "Select time" but we don't have that string (BIT-1405) text = stringResource(id = R.string.time), + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.labelMedium, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimeSelectButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimeSelectButton.kt index e8d326cc39..4c79ef90ab 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimeSelectButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimeSelectButton.kt @@ -3,9 +3,7 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -19,6 +17,7 @@ import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.role import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldButtonColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.util.orNow @@ -80,18 +79,10 @@ fun BitwardenTimeSelectButton( Icon( painter = rememberVectorPainter(id = R.drawable.ic_region_select_dropdown), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, ) }, - colors = OutlinedTextFieldDefaults.colors( - disabledTextColor = MaterialTheme.colorScheme.onSurface, - disabledBorderColor = MaterialTheme.colorScheme.outline, - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledSupportingTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTextFieldButtonColors(), ) if (shouldShowDialog) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt index b99498036b..831f4200f2 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.dialog import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow @@ -15,7 +14,6 @@ import androidx.compose.foundation.layout.requiredWidthIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -31,6 +29,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton +import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider import com.x8bit.bitwarden.ui.platform.components.util.maxDialogHeight import com.x8bit.bitwarden.ui.platform.components.util.maxDialogWidth import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -60,8 +59,8 @@ fun BitwardenTwoButtonDialog( onConfirmClick: () -> Unit, onDismissClick: () -> Unit, onDismissRequest: () -> Unit, - confirmTextColor: Color? = null, - dismissTextColor: Color? = null, + confirmTextColor: Color = BitwardenTheme.colorScheme.outlineButton.foreground, + dismissTextColor: Color = BitwardenTheme.colorScheme.outlineButton.foreground, ) { Dialog( onDismissRequest = onDismissRequest, @@ -83,7 +82,7 @@ fun BitwardenTwoButtonDialog( ) // This background is necessary for the dialog to not be transparent. .background( - color = MaterialTheme.colorScheme.surfaceContainerHigh, + color = BitwardenTheme.colorScheme.background.primary, shape = RoundedCornerShape(28.dp), ), horizontalAlignment = Alignment.End, @@ -96,18 +95,13 @@ fun BitwardenTwoButtonDialog( .padding(horizontal = 24.dp) .fillMaxWidth(), text = title, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.headlineSmall, ) Spacer(modifier = Modifier.height(16.dp)) } if (scrollState.canScrollBackward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } Text( modifier = Modifier @@ -117,16 +111,11 @@ fun BitwardenTwoButtonDialog( .padding(horizontal = 24.dp) .fillMaxWidth(), text = message, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, ) if (scrollState.canScrollForward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } Spacer(modifier = Modifier.height(12.dp)) FlowRow( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenBasicDialogRow.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenBasicDialogRow.kt index 36d2379d13..9034c6455a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenBasicDialogRow.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenBasicDialogRow.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -34,7 +33,9 @@ fun BitwardenBasicDialogRow( modifier = modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .padding( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenSelectionRow.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenSelectionRow.kt index 6ce84654a8..238eb53c2a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenSelectionRow.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/row/BitwardenSelectionRow.kt @@ -1,12 +1,14 @@ package com.x8bit.bitwarden.ui.platform.components.dialog.row import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text +import androidx.compose.material3.ripple import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.selected @@ -33,7 +35,13 @@ fun BitwardenSelectionRow( Row( modifier = modifier .fillMaxWidth() - .clickable(onClick = onClick) + .clickable( + interactionSource = remember { MutableInteractionSource() }, + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), + onClick = onClick, + ) .semantics(mergeDescendants = true) { selected = isSelected }, @@ -46,7 +54,7 @@ fun BitwardenSelectionRow( ) Text( text = text(), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyLarge, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/divider/BitwardenHorizontalDivider.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/divider/BitwardenHorizontalDivider.kt index 3e55f0e811..ac84971006 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/divider/BitwardenHorizontalDivider.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/divider/BitwardenHorizontalDivider.kt @@ -1,12 +1,12 @@ package com.x8bit.bitwarden.ui.platform.components.divider import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A divider line. @@ -20,7 +20,7 @@ import androidx.compose.ui.unit.dp fun BitwardenHorizontalDivider( modifier: Modifier = Modifier, thickness: Dp = 1.dp, - color: Color = MaterialTheme.colorScheme.outlineVariant, + color: Color = BitwardenTheme.colorScheme.stroke.divider, ) { HorizontalDivider( modifier = modifier, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/BitwardenMultiSelectButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/BitwardenMultiSelectButton.kt index 855025e565..12a0bdcb58 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/BitwardenMultiSelectButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/BitwardenMultiSelectButton.kt @@ -8,10 +8,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text +import androidx.compose.material3.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -33,6 +32,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenSelectionDialog import com.x8bit.bitwarden.ui.platform.components.dialog.row.BitwardenSelectionRow +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldButtonColors import com.x8bit.bitwarden.ui.platform.components.model.TooltipData import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -91,7 +91,9 @@ fun BitwardenMultiSelectButton( } .fillMaxWidth() .clickable( - indication = null, + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), enabled = isEnabled, interactionSource = remember { MutableInteractionSource() }, ) { @@ -113,7 +115,7 @@ fun BitwardenMultiSelectButton( contentDescription = it.contentDescription, onClick = it.onClick, isEnabled = isEnabled, - contentColor = MaterialTheme.colorScheme.primary, + contentColor = BitwardenTheme.colorScheme.icon.secondary, modifier = Modifier.size(16.dp), ) } @@ -126,18 +128,10 @@ fun BitwardenMultiSelectButton( Icon( painter = rememberVectorPainter(id = R.drawable.ic_region_select_dropdown), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, ) }, - colors = OutlinedTextFieldDefaults.colors( - disabledTextColor = MaterialTheme.colorScheme.onSurface, - disabledBorderColor = MaterialTheme.colorScheme.outline, - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledSupportingTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTextFieldButtonColors(), supportingText = supportingText?.let { { Text( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/EnvironmentSelector.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/EnvironmentSelector.kt index a523f82bcd..4d0089b06b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/EnvironmentSelector.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dropdown/EnvironmentSelector.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -60,7 +59,7 @@ fun EnvironmentSelector( .clickable( indication = ripple( bounded = true, - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.background.pressed, ), interactionSource = remember { MutableInteractionSource() }, onClick = { shouldShowDialog = !shouldShowDialog }, @@ -74,19 +73,19 @@ fun EnvironmentSelector( Text( text = labelText, style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.padding(end = 12.dp), ) Text( text = selectedOption.displayLabel(), style = BitwardenTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, modifier = Modifier.padding(end = 8.dp), ) Icon( painter = rememberVectorPainter(id = R.drawable.ic_region_select_dropdown), contentDescription = stringResource(id = R.string.region), - tint = MaterialTheme.colorScheme.primary, + tint = BitwardenTheme.colorScheme.icon.secondary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/fab/BitwardenFloatingActionButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/fab/BitwardenFloatingActionButton.kt index 89a231a0c2..ae018d3714 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/fab/BitwardenFloatingActionButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/fab/BitwardenFloatingActionButton.kt @@ -2,10 +2,10 @@ package com.x8bit.bitwarden.ui.platform.components.fab import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.painter.Painter +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * Represents a Bitwarden-styled [FloatingActionButton]. @@ -23,14 +23,14 @@ fun BitwardenFloatingActionButton( modifier: Modifier = Modifier, ) { FloatingActionButton( - containerColor = MaterialTheme.colorScheme.primaryContainer, + containerColor = BitwardenTheme.colorScheme.filledButton.background, + contentColor = BitwardenTheme.colorScheme.filledButton.foreground, onClick = onClick, modifier = modifier, ) { Icon( painter = painter, contentDescription = contentDescription, - tint = MaterialTheme.colorScheme.onPrimaryContainer, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenHiddenPasswordField.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenHiddenPasswordField.kt index 2c318eea0a..0041ac966a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenHiddenPasswordField.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenHiddenPasswordField.kt @@ -1,15 +1,14 @@ package com.x8bit.bitwarden.ui.platform.components.field import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.tooling.preview.Preview +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -36,15 +35,7 @@ fun BitwardenHiddenPasswordField( enabled = false, readOnly = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), - colors = OutlinedTextFieldDefaults.colors( - disabledTextColor = MaterialTheme.colorScheme.onSurface, - disabledBorderColor = MaterialTheme.colorScheme.outline, - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledSupportingTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - ), + colors = bitwardenTextFieldColors(), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenPasswordField.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenPasswordField.kt index 953e845226..c54ca94e49 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenPasswordField.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenPasswordField.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.field import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -26,6 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.tabNavigation import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors import com.x8bit.bitwarden.ui.platform.components.util.nonLetterColorVisualTransformation import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -74,6 +74,7 @@ fun BitwardenPasswordField( modifier = modifier .tabNavigation() .focusRequester(focusRequester), + colors = bitwardenTextFieldColors(), textStyle = BitwardenTheme.typography.sensitiveInfoSmall, label = { Text(text = label) }, value = value, @@ -110,7 +111,6 @@ fun BitwardenPasswordField( id = if (showPassword) R.string.hide else R.string.show, ), onClick = { showPasswordChange.invoke(!showPassword) }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextField.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextField.kt index d7cf3bf1e1..376ed4c61f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextField.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextField.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.field import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -22,6 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.ui.platform.base.util.toPx import com.x8bit.bitwarden.ui.platform.base.util.withLineBreaksAtWidth +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors import com.x8bit.bitwarden.ui.platform.components.model.IconResource import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -80,6 +80,7 @@ fun BitwardenTextField( } OutlinedTextField( + colors = bitwardenTextFieldColors(), modifier = modifier .onGloballyPositioned { widthPx = it.size.width } .focusRequester(focusRequester), @@ -91,15 +92,18 @@ fun BitwardenTextField( Icon( painter = iconResource.iconPainter, contentDescription = iconResource.contentDescription, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, ) } }, - trailingIcon = trailingIconContent?.let { - trailingIconContent - }, + trailingIcon = trailingIconContent, placeholder = placeholder?.let { - { Text(text = it) } + { + Text( + text = it, + color = BitwardenTheme.colorScheme.text.primary, + ) + } }, supportingText = hint?.let { { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/color/BitwardenTextFieldColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/color/BitwardenTextFieldColors.kt new file mode 100644 index 0000000000..7a28861299 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/color/BitwardenTextFieldColors.kt @@ -0,0 +1,89 @@ +package com.x8bit.bitwarden.ui.platform.components.field.color + +import androidx.compose.foundation.text.selection.TextSelectionColors +import androidx.compose.material3.TextFieldColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for a read-only text field button. + */ +@Composable +fun bitwardenTextFieldButtonColors(): TextFieldColors = bitwardenTextFieldColors( + unfocusedBorderColor = BitwardenTheme.colorScheme.stroke.divider, + focusedBorderColor = BitwardenTheme.colorScheme.stroke.divider, + disabledTextColor = BitwardenTheme.colorScheme.text.primary, + disabledBorderColor = BitwardenTheme.colorScheme.stroke.divider, + disabledLeadingIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledTrailingIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledLabelColor = BitwardenTheme.colorScheme.text.secondary, + disabledPlaceholderColor = BitwardenTheme.colorScheme.text.secondary, + disabledSupportingTextColor = BitwardenTheme.colorScheme.text.secondary, +) + +/** + * Provides a default set of Bitwarden-styled colors for text fields. + */ +@Composable +fun bitwardenTextFieldColors( + unfocusedBorderColor: Color = BitwardenTheme.colorScheme.stroke.divider, + focusedBorderColor: Color = BitwardenTheme.colorScheme.stroke.border, + disabledTextColor: Color = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + disabledBorderColor: Color = BitwardenTheme.colorScheme.outlineButton.borderDisabled, + disabledLeadingIconColor: Color = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + disabledTrailingIconColor: Color = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + disabledLabelColor: Color = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + disabledPlaceholderColor: Color = BitwardenTheme.colorScheme.text.secondary, + disabledSupportingTextColor: Color = BitwardenTheme + .colorScheme + .outlineButton + .foregroundDisabled, +): TextFieldColors = TextFieldColors( + focusedTextColor = BitwardenTheme.colorScheme.text.primary, + unfocusedTextColor = BitwardenTheme.colorScheme.text.primary, + disabledTextColor = disabledTextColor, + errorTextColor = BitwardenTheme.colorScheme.text.primary, + focusedContainerColor = Color.Transparent, + unfocusedContainerColor = Color.Transparent, + disabledContainerColor = Color.Transparent, + errorContainerColor = Color.Transparent, + cursorColor = BitwardenTheme.colorScheme.icon.primary, + errorCursorColor = BitwardenTheme.colorScheme.icon.primary, + textSelectionColors = TextSelectionColors( + handleColor = BitwardenTheme.colorScheme.stroke.border, + backgroundColor = BitwardenTheme.colorScheme.stroke.border.copy(alpha = 0.4f), + ), + focusedIndicatorColor = focusedBorderColor, + unfocusedIndicatorColor = unfocusedBorderColor, + disabledIndicatorColor = disabledBorderColor, + errorIndicatorColor = BitwardenTheme.colorScheme.status.error, + focusedLeadingIconColor = BitwardenTheme.colorScheme.icon.primary, + unfocusedLeadingIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledLeadingIconColor = disabledLeadingIconColor, + errorLeadingIconColor = BitwardenTheme.colorScheme.icon.primary, + focusedTrailingIconColor = BitwardenTheme.colorScheme.icon.primary, + unfocusedTrailingIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledTrailingIconColor = disabledTrailingIconColor, + errorTrailingIconColor = BitwardenTheme.colorScheme.status.error, + focusedLabelColor = BitwardenTheme.colorScheme.text.secondary, + unfocusedLabelColor = BitwardenTheme.colorScheme.text.secondary, + disabledLabelColor = disabledLabelColor, + errorLabelColor = BitwardenTheme.colorScheme.status.error, + focusedPlaceholderColor = BitwardenTheme.colorScheme.text.secondary, + unfocusedPlaceholderColor = BitwardenTheme.colorScheme.text.secondary, + disabledPlaceholderColor = disabledPlaceholderColor, + errorPlaceholderColor = BitwardenTheme.colorScheme.text.secondary, + focusedSupportingTextColor = BitwardenTheme.colorScheme.text.secondary, + unfocusedSupportingTextColor = BitwardenTheme.colorScheme.text.secondary, + disabledSupportingTextColor = disabledSupportingTextColor, + errorSupportingTextColor = BitwardenTheme.colorScheme.text.secondary, + focusedPrefixColor = BitwardenTheme.colorScheme.text.secondary, + unfocusedPrefixColor = BitwardenTheme.colorScheme.text.secondary, + disabledPrefixColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + errorPrefixColor = BitwardenTheme.colorScheme.status.error, + focusedSuffixColor = BitwardenTheme.colorScheme.text.secondary, + unfocusedSuffixColor = BitwardenTheme.colorScheme.text.secondary, + disabledSuffixColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + errorSuffixColor = BitwardenTheme.colorScheme.status.error, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderText.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderText.kt index b456bf5337..63b1acf725 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderText.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderText.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.platform.components.header import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -23,7 +22,7 @@ fun BitwardenListHeaderText( Text( text = label, style = BitwardenTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = modifier.padding( top = 12.dp, bottom = 4.dp, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderTextWithSupportingText.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderTextWithSupportingText.kt index 822b902c6b..aedb2ac398 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderTextWithSupportingText.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/header/BitwardenListHeaderTextWithSupportingText.kt @@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.platform.components.header import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -38,13 +37,13 @@ fun BitwardenListHeaderTextWithSupportLabel( Text( text = label, style = BitwardenTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) Text( text = supportingLabel, style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularCountdownIndicator.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularCountdownIndicator.kt index a505d5337c..bf216128f0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularCountdownIndicator.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularCountdownIndicator.kt @@ -6,12 +6,12 @@ import androidx.compose.animation.core.tween import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.material3.CircularProgressIndicator -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -46,7 +46,8 @@ fun BitwardenCircularCountdownIndicator( CircularProgressIndicator( progress = { progressAnimate }, modifier = Modifier.size(size = 30.dp), - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.icon.secondary, + trackColor = Color.Transparent, strokeWidth = 3.dp, strokeCap = StrokeCap.Round, ) @@ -54,7 +55,7 @@ fun BitwardenCircularCountdownIndicator( Text( text = timeLeftSeconds.toString(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularProgressIndicator.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularProgressIndicator.kt index 05b3c07a65..4f43d6f021 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularProgressIndicator.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/indicator/BitwardenCircularProgressIndicator.kt @@ -3,6 +3,7 @@ package com.x8bit.bitwarden.ui.platform.components.indicator import androidx.compose.material3.CircularProgressIndicator import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A Bitwarden-styled [CircularProgressIndicator]. @@ -11,5 +12,8 @@ import androidx.compose.ui.Modifier fun BitwardenCircularProgressIndicator( modifier: Modifier = Modifier, ) { - CircularProgressIndicator(modifier = modifier) + CircularProgressIndicator( + modifier = modifier, + color = BitwardenTheme.colorScheme.stroke.border, + ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenGroupItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenGroupItem.kt index 7aa62bcbcf..9842613e97 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenGroupItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenGroupItem.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -51,7 +50,9 @@ fun BitwardenGroupItem( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .bottomDivider( @@ -70,7 +71,7 @@ fun BitwardenGroupItem( Icon( painter = startIcon, contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .semantics { startIconTestTag?.let { testTag = it } } .size(24.dp), @@ -79,20 +80,20 @@ fun BitwardenGroupItem( Text( text = label, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.weight(1f), ) Text( text = supportingLabel, style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) Icon( painter = rememberVectorPainter(id = R.drawable.ic_navigate_next), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .mirrorIfRtl() .size(24.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenListItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenListItem.kt index 58de31e09c..10cdb9f12b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenListItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/listitem/BitwardenListItem.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -82,7 +81,9 @@ fun BitwardenListItem( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .defaultMinSize(minHeight = 72.dp) @@ -94,7 +95,7 @@ fun BitwardenListItem( BitwardenIcon( iconData = startIcon, contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .semantics { startIconTestTag?.let { testTag = it } } .size(24.dp), @@ -107,7 +108,7 @@ fun BitwardenListItem( Text( text = label, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier @@ -120,7 +121,7 @@ fun BitwardenListItem( Icon( painter = iconResource.iconPainter, contentDescription = iconResource.contentDescription, - tint = MaterialTheme.colorScheme.secondary, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .semantics { iconResource.testTag?.let { testTag = it } } .size(16.dp), @@ -132,7 +133,7 @@ fun BitwardenListItem( Text( text = secondSupportLabel, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.semantics { secondSupportingLabelTestTag?.let { testTag = it } }, @@ -143,7 +144,7 @@ fun BitwardenListItem( Text( text = supportLabel, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.semantics { supportingLabelTestTag?.let { testTag = it } }, ) } @@ -154,7 +155,6 @@ fun BitwardenListItem( vectorIconRes = R.drawable.ic_more_horizontal, contentDescription = stringResource(id = R.string.options), onClick = { shouldShowDialog = true }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.semantics { optionsTestTag?.let { testTag = it } }, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/BitwardenNavigationBarItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/BitwardenNavigationBarItem.kt index 4033271d84..c7180e0323 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/BitwardenNavigationBarItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/BitwardenNavigationBarItem.kt @@ -5,15 +5,14 @@ import androidx.annotation.StringRes import androidx.compose.foundation.layout.RowScope import androidx.compose.material3.BadgedBox import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBarItem -import androidx.compose.material3.NavigationBarItemDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import com.x8bit.bitwarden.ui.platform.components.badge.NotificationBadge +import com.x8bit.bitwarden.ui.platform.components.navigation.color.bitwardenNavigationBarItemColors import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter /** @@ -66,13 +65,7 @@ fun RowScope.BitwardenNavigationBarItem( }, selected = isSelected, onClick = onClick, - colors = NavigationBarItemDefaults.colors( - indicatorColor = MaterialTheme.colorScheme.secondaryContainer, - selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer, - unselectedIconColor = MaterialTheme.colorScheme.onSurface, - selectedTextColor = MaterialTheme.colorScheme.onSecondaryContainer, - unselectedTextColor = MaterialTheme.colorScheme.onSurface, - ), + colors = bitwardenNavigationBarItemColors(), modifier = modifier, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/color/BitwardenNavigationBarItemColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/color/BitwardenNavigationBarItemColors.kt new file mode 100644 index 0000000000..c4a39fa56e --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/navigation/color/BitwardenNavigationBarItemColors.kt @@ -0,0 +1,20 @@ +package com.x8bit.bitwarden.ui.platform.components.navigation.color + +import androidx.compose.material3.NavigationBarItemColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for navigation bar items. + */ +@Composable +fun bitwardenNavigationBarItemColors(): NavigationBarItemColors = NavigationBarItemColors( + selectedIconColor = BitwardenTheme.colorScheme.icon.secondary, + unselectedIconColor = BitwardenTheme.colorScheme.icon.primary, + disabledIconColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + selectedTextColor = BitwardenTheme.colorScheme.icon.secondary, + unselectedTextColor = BitwardenTheme.colorScheme.icon.primary, + disabledTextColor = BitwardenTheme.colorScheme.outlineButton.foregroundDisabled, + selectedIndicatorColor = Color.Transparent, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/BitwardenRadioButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/BitwardenRadioButton.kt index f77759e8cb..f21229b1f7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/BitwardenRadioButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/BitwardenRadioButton.kt @@ -1,9 +1,9 @@ package com.x8bit.bitwarden.ui.platform.components.radio import androidx.compose.material3.RadioButton -import androidx.compose.material3.RadioButtonDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import com.x8bit.bitwarden.ui.platform.components.radio.color.bitwardenRadioButtonColors /** * A custom Bitwarden-themed radio button. @@ -22,6 +22,6 @@ fun BitwardenRadioButton( modifier = modifier, selected = isSelected, onClick = onClick, - colors = RadioButtonDefaults.colors(), + colors = bitwardenRadioButtonColors(), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/color/BitwardenRadioButtonColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/color/BitwardenRadioButtonColors.kt new file mode 100644 index 0000000000..2fcda867ce --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/radio/color/BitwardenRadioButtonColors.kt @@ -0,0 +1,16 @@ +package com.x8bit.bitwarden.ui.platform.components.radio.color + +import androidx.compose.material3.RadioButtonColors +import androidx.compose.runtime.Composable +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for radio buttons. + */ +@Composable +fun bitwardenRadioButtonColors(): RadioButtonColors = RadioButtonColors( + selectedColor = BitwardenTheme.colorScheme.filledButton.background, + unselectedColor = BitwardenTheme.colorScheme.icon.primary, + disabledSelectedColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledUnselectedColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenExternalLinkRow.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenExternalLinkRow.kt index 5f62878ebb..f9b60bd887 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenExternalLinkRow.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenExternalLinkRow.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.platform.components.row import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -57,7 +56,7 @@ fun BitwardenExternalLinkRow( modifier = Modifier.mirrorIfRtl(), painter = rememberVectorPainter(id = R.drawable.ic_external_link), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenTextRow.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenTextRow.kt index 2839414e99..f23d3593ce 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenTextRow.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenTextRow.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -51,7 +50,9 @@ fun BitwardenTextRow( .clickable( enabled = isEnabled, interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .semantics(mergeDescendants = true) { }, @@ -72,17 +73,21 @@ fun BitwardenTextRow( Text( text = text, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface.copy( - alpha = if (isEnabled) 1.0f else 0.38f, - ), + color = if (isEnabled) { + BitwardenTheme.colorScheme.text.primary + } else { + BitwardenTheme.colorScheme.filledButton.foregroundDisabled + }, ) description?.let { Text( text = it, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant.copy( - alpha = if (isEnabled) 1.0f else 0.38f, - ), + color = if (isEnabled) { + BitwardenTheme.colorScheme.text.secondary + } else { + BitwardenTheme.colorScheme.filledButton.foregroundDisabled + }, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scaffold/BitwardenScaffold.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scaffold/BitwardenScaffold.kt index c11fd0fe34..3804d66538 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scaffold/BitwardenScaffold.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scaffold/BitwardenScaffold.kt @@ -9,10 +9,8 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FabPosition -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.ScaffoldDefaults -import androidx.compose.material3.contentColorFor import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults import androidx.compose.material3.pulltorefresh.pullToRefresh import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState @@ -24,6 +22,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * Direct passthrough to [Scaffold] but contains a few specific override values. Everything is @@ -39,8 +38,8 @@ fun BitwardenScaffold( floatingActionButton: @Composable () -> Unit = { }, floatingActionButtonPosition: FabPosition = FabPosition.End, pullToRefreshState: BitwardenPullToRefreshState = rememberBitwardenPullToRefreshState(), - containerColor: Color = MaterialTheme.colorScheme.surface, - contentColor: Color = contentColorFor(containerColor), + containerColor: Color = BitwardenTheme.colorScheme.background.primary, + contentColor: Color = BitwardenTheme.colorScheme.text.primary, contentWindowInsets: WindowInsets = ScaffoldDefaults .contentWindowInsets .exclude(WindowInsets.navigationBars), @@ -80,6 +79,8 @@ fun BitwardenScaffold( .align(Alignment.TopCenter), isRefreshing = pullToRefreshState.isRefreshing, state = internalPullToRefreshState, + containerColor = BitwardenTheme.colorScheme.background.secondary, + color = BitwardenTheme.colorScheme.icon.secondary, ) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scrim/BitwardenAnimatedScrim.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scrim/BitwardenAnimatedScrim.kt index 821ab5472b..5bb0300869 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scrim/BitwardenAnimatedScrim.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/scrim/BitwardenAnimatedScrim.kt @@ -10,7 +10,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * A scrim that animates its visibility. @@ -33,7 +33,7 @@ fun BitwardenAnimatedScrim( ) { Box( modifier = modifier - .background(Color.Black.copy(alpha = 0.40f)) + .background(BitwardenTheme.colorScheme.background.scrim) .clickable( interactionSource = remember { MutableInteractionSource() }, // Clear the ripple diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/BitwardenSegmentedButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/BitwardenSegmentedButton.kt index 22968b4bc5..44bfb3fd35 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/BitwardenSegmentedButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/BitwardenSegmentedButton.kt @@ -8,6 +8,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTag +import com.x8bit.bitwarden.ui.platform.components.segment.color.bitwardenSegmentedButtonColors import kotlinx.collections.immutable.ImmutableList /** @@ -28,6 +29,7 @@ fun BitwardenSegmentedButton( SegmentedButton( selected = option.isChecked, onClick = option.onClick, + colors = bitwardenSegmentedButtonColors(), shape = SegmentedButtonDefaults.itemShape( index = index, count = options.size, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/color/BitwardenSegmentedButtonColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/color/BitwardenSegmentedButtonColors.kt new file mode 100644 index 0000000000..00d1bddfdc --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/segment/color/BitwardenSegmentedButtonColors.kt @@ -0,0 +1,24 @@ +package com.x8bit.bitwarden.ui.platform.components.segment.color + +import androidx.compose.material3.SegmentedButtonColors +import androidx.compose.runtime.Composable +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for segmented buttons. + */ +@Composable +fun bitwardenSegmentedButtonColors(): SegmentedButtonColors = SegmentedButtonColors( + activeContainerColor = BitwardenTheme.colorScheme.filledButton.backgroundReversed, + activeContentColor = BitwardenTheme.colorScheme.filledButton.foregroundReversed, + activeBorderColor = BitwardenTheme.colorScheme.stroke.divider, + inactiveContainerColor = BitwardenTheme.colorScheme.background.primary, + inactiveContentColor = BitwardenTheme.colorScheme.text.secondary, + inactiveBorderColor = BitwardenTheme.colorScheme.stroke.divider, + disabledActiveContainerColor = BitwardenTheme.colorScheme.background.primary, + disabledActiveContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledActiveBorderColor = BitwardenTheme.colorScheme.stroke.divider, + disabledInactiveContainerColor = BitwardenTheme.colorScheme.background.primary, + disabledInactiveContentColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledInactiveBorderColor = BitwardenTheme.colorScheme.stroke.divider, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/BitwardenSlider.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/BitwardenSlider.kt index 8f68478799..fabdf01551 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/BitwardenSlider.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/BitwardenSlider.kt @@ -22,7 +22,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.focusProperties -import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.onPreviewKeyEvent @@ -38,6 +37,8 @@ import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.toDp +import com.x8bit.bitwarden.ui.platform.components.field.color.bitwardenTextFieldColors +import com.x8bit.bitwarden.ui.platform.components.slider.color.bitwardenSliderColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -89,6 +90,7 @@ fun BitwardenSlider( }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + colors = bitwardenTextFieldColors(), modifier = Modifier .onPreviewKeyEvent { keyEvent -> when (keyEvent.key) { @@ -111,23 +113,17 @@ fun BitwardenSlider( .width(width = 16.dp + labelTextWidth + 16.dp), ) - val colors = SliderDefaults.colors( - activeTickColor = Color.Transparent, - inactiveTickColor = Color.Transparent, - disabledActiveTickColor = Color.Transparent, - disabledInactiveTickColor = Color.Transparent, - ) Slider( value = sliderValue.toFloat(), onValueChange = { newValue -> onValueChange(newValue.toInt(), true) }, onValueChangeFinished = { onValueChange(sliderValue, false) }, valueRange = range.start.toFloat()..range.endInclusive.toFloat(), steps = range.endInclusive - 1, - colors = colors, + colors = bitwardenSliderColors(), thumb = { SliderDefaults.Thumb( interactionSource = remember { MutableInteractionSource() }, - colors = colors, + colors = bitwardenSliderColors(), thumbSize = DpSize(width = 20.dp, height = 20.dp), ) }, @@ -135,7 +131,7 @@ fun BitwardenSlider( SliderDefaults.Track( modifier = Modifier.height(height = 4.dp), drawStopIndicator = null, - colors = colors, + colors = bitwardenSliderColors(), sliderState = sliderState, thumbTrackGapSize = 0.dp, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/color/BitwardenSliderColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/color/BitwardenSliderColors.kt new file mode 100644 index 0000000000..13a9e0f99c --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/slider/color/BitwardenSliderColors.kt @@ -0,0 +1,23 @@ +package com.x8bit.bitwarden.ui.platform.components.slider.color + +import androidx.compose.material3.SliderColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for sliders. + */ +@Composable +fun bitwardenSliderColors(): SliderColors = SliderColors( + thumbColor = BitwardenTheme.colorScheme.sliderButton.knobBackground, + activeTrackColor = BitwardenTheme.colorScheme.sliderButton.filled, + activeTickColor = Color.Transparent, + inactiveTrackColor = BitwardenTheme.colorScheme.sliderButton.unfilled, + inactiveTickColor = Color.Transparent, + disabledThumbColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledActiveTrackColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledActiveTickColor = Color.Transparent, + disabledInactiveTrackColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledInactiveTickColor = Color.Transparent, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenClickableText.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenClickableText.kt index 5b786b0bdc..e569cd3e05 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenClickableText.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenClickableText.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -19,6 +18,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * Represents a Bitwarden-styled clickable text. @@ -35,7 +35,7 @@ fun BitwardenClickableText( modifier: Modifier = Modifier, innerPadding: PaddingValues = PaddingValues(vertical = 4.dp, horizontal = 16.dp), cornerSize: Dp = 28.dp, - color: Color = MaterialTheme.colorScheme.primary, + color: Color = BitwardenTheme.colorScheme.text.interaction, ) { Text( modifier = modifier @@ -43,7 +43,7 @@ fun BitwardenClickableText( .clickable( indication = ripple( bounded = true, - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.background.pressed, ), interactionSource = remember { MutableInteractionSource() }, onClick = onClick, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenPolicyWarning.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenPolicyWarning.kt index bab2f101cd..983ffaa05b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenPolicyWarning.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/text/BitwardenPolicyWarning.kt @@ -1,9 +1,8 @@ package com.x8bit.bitwarden.ui.platform.components.text -import androidx.compose.foundation.border +import androidx.compose.foundation.background import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -32,14 +31,13 @@ fun BitwardenPolicyWarningText( text = text, textAlign = textAlign, style = style, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = modifier - .border( - width = 1.dp, - color = MaterialTheme.colorScheme.primary, - shape = RoundedCornerShape(4.dp), + .background( + color = BitwardenTheme.colorScheme.background.tertiary, + shape = RoundedCornerShape(size = 8.dp), ) - .padding(8.dp), + .padding(all = 16.dp), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitch.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitch.kt index 2ed33dae7c..1f26189709 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitch.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitch.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.material3.ripple @@ -23,6 +22,7 @@ import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.state.ToggleableState import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.toggle.color.bitwardenSwitchColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -50,7 +50,9 @@ fun BitwardenSwitch( if (onCheckedChange != null) { this.clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onCheckedChange.invoke(!isChecked) }, ) } else { @@ -69,6 +71,7 @@ fun BitwardenSwitch( .width(52.dp), checked = isChecked, onCheckedChange = null, + colors = bitwardenSwitchColors(), ) Spacer(modifier = Modifier.width(16.dp)) @@ -79,14 +82,14 @@ fun BitwardenSwitch( Text( text = label, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) description?.let { Text( text = it, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt index 614de1e667..d5eb714a86 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -47,7 +46,9 @@ fun BitwardenSwitchWithActions( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onCheckedChange?.invoke(!isChecked) }, ) .semantics(mergeDescendants = true) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenWideSwitch.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenWideSwitch.kt index 8173af7492..226a618f88 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenWideSwitch.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenWideSwitch.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.material3.ripple @@ -24,6 +23,7 @@ import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.state.ToggleableState import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.x8bit.bitwarden.ui.platform.components.toggle.color.bitwardenSwitchColors import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -57,7 +57,9 @@ fun BitwardenWideSwitch( .wrapContentHeight() .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onCheckedChange?.invoke(!isChecked) }, enabled = !readOnly && enabled, ) @@ -76,9 +78,9 @@ fun BitwardenWideSwitch( text = label, style = BitwardenTheme.typography.bodyLarge, color = if (enabled) { - MaterialTheme.colorScheme.onSurface + BitwardenTheme.colorScheme.text.primary } else { - MaterialTheme.colorScheme.outline + BitwardenTheme.colorScheme.filledButton.foregroundDisabled }, ) description?.let { @@ -86,9 +88,9 @@ fun BitwardenWideSwitch( text = it, style = BitwardenTheme.typography.bodyMedium, color = if (enabled) { - MaterialTheme.colorScheme.onSurfaceVariant + BitwardenTheme.colorScheme.text.secondary } else { - MaterialTheme.colorScheme.outline + BitwardenTheme.colorScheme.filledButton.foregroundDisabled }, ) } @@ -102,6 +104,7 @@ fun BitwardenWideSwitch( enabled = enabled, checked = isChecked, onCheckedChange = null, + colors = bitwardenSwitchColors(), ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/color/BitwardenSwitchColors.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/color/BitwardenSwitchColors.kt new file mode 100644 index 0000000000..200ef20add --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/color/BitwardenSwitchColors.kt @@ -0,0 +1,29 @@ +package com.x8bit.bitwarden.ui.platform.components.toggle.color + +import androidx.compose.material3.SwitchColors +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme + +/** + * Provides a default set of Bitwarden-styled colors for switches. + */ +@Composable +fun bitwardenSwitchColors(): SwitchColors = SwitchColors( + checkedThumbColor = BitwardenTheme.colorScheme.toggleButton.switch, + checkedTrackColor = BitwardenTheme.colorScheme.toggleButton.backgroundOn, + checkedBorderColor = Color.Transparent, + checkedIconColor = BitwardenTheme.colorScheme.toggleButton.backgroundOn, + uncheckedThumbColor = BitwardenTheme.colorScheme.toggleButton.switch, + uncheckedTrackColor = BitwardenTheme.colorScheme.toggleButton.backgroundOff, + uncheckedBorderColor = Color.Transparent, + uncheckedIconColor = BitwardenTheme.colorScheme.toggleButton.backgroundOn, + disabledCheckedThumbColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledCheckedTrackColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledCheckedBorderColor = Color.Transparent, + disabledCheckedIconColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledUncheckedThumbColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled, + disabledUncheckedTrackColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, + disabledUncheckedBorderColor = Color.Transparent, + disabledUncheckedIconColor = BitwardenTheme.colorScheme.filledButton.backgroundDisabled, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/NonLetterColorVisualTransformation.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/NonLetterColorVisualTransformation.kt index c7d3db719f..5f7e1f09b6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/NonLetterColorVisualTransformation.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/NonLetterColorVisualTransformation.kt @@ -1,6 +1,5 @@ package com.x8bit.bitwarden.ui.platform.components.util -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color @@ -10,6 +9,7 @@ import androidx.compose.ui.text.input.OffsetMapping import androidx.compose.ui.text.input.TransformedText import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.withStyle +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** * Returns the [VisualTransformation] that alters the output of the text in an input field by @@ -17,8 +17,8 @@ import androidx.compose.ui.text.withStyle */ @Composable fun nonLetterColorVisualTransformation(): VisualTransformation { - val digitColor = MaterialTheme.colorScheme.primary - val specialCharacterColor = MaterialTheme.colorScheme.error + val digitColor = BitwardenTheme.colorScheme.text.codeBlue + val specialCharacterColor = BitwardenTheme.colorScheme.text.codePink return remember(digitColor, specialCharacterColor) { NonLetterColorVisualTransformation( digitColor = digitColor, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuScreen.kt index f65a3fe4a7..be613928e0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuScreen.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable @@ -189,7 +188,7 @@ private fun OnboardingOverrideContent( .align(Alignment.CenterHorizontally) .standardHorizontalMargin(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, ) Spacer(Modifier.height(16.dp)) @@ -208,7 +207,7 @@ private fun OnboardingOverrideContent( .align(Alignment.CenterHorizontally) .standardHorizontalMargin(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchEmptyContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchEmptyContent.kt index 003f12a00b..3490bddcff 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchEmptyContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchEmptyContent.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -37,7 +36,7 @@ fun SearchEmptyContent( Icon( painter = rememberVectorPainter(id = R.drawable.ic_search), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .size(74.dp) .padding(horizontal = 16.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsScreen.kt index 2bac799527..01e228cd21 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -120,7 +119,9 @@ private fun SettingsRow( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .bottomDivider(paddingStart = 16.dp) @@ -136,7 +137,7 @@ private fun SettingsRow( .weight(1f), text = text(), style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) TrailingContent(notificationCount = notificationCount) } @@ -162,7 +163,7 @@ private fun TrailingContent( Icon( painter = rememberVectorPainter(id = R.drawable.ic_navigate_next), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .mirrorIfRtl() .size(24.dp), @@ -177,7 +178,7 @@ private fun SettingsRows_preview() { BitwardenTheme { Column( modifier = Modifier - .background(MaterialTheme.colorScheme.background) + .background(BitwardenTheme.colorScheme.background.primary) .padding(16.dp) .fillMaxSize(), ) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutScreen.kt index de7fd7d795..4065a9d7ac 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -231,7 +230,7 @@ private fun ContentColumn( modifier = Modifier.padding(end = 16.dp), text = state.copyrightInfo.invoke(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) } } @@ -249,7 +248,9 @@ private fun CopyRow( modifier = modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .semantics(mergeDescendants = true) { @@ -270,12 +271,12 @@ private fun CopyRow( .weight(1f), text = text(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) Icon( painter = rememberVectorPainter(id = R.drawable.ic_copy), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, ) } BitwardenHorizontalDivider(modifier = Modifier.padding(start = 16.dp)) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt index 948950695e..ab9b0ce03d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.AlertDialog import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -68,7 +67,6 @@ import com.x8bit.bitwarden.ui.platform.composition.LocalIntentManager import com.x8bit.bitwarden.ui.platform.manager.biometrics.BiometricsManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors import com.x8bit.bitwarden.ui.platform.util.displayLabel import com.x8bit.bitwarden.ui.platform.util.minutes import com.x8bit.bitwarden.ui.platform.util.toFormattedPattern @@ -488,7 +486,7 @@ private fun SessionTimeoutRow( Text( text = selectedVaultTimeoutType.displayLabel(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.testTag("SessionTimeoutStatusLabel"), ) } @@ -564,7 +562,7 @@ private fun SessionCustomTimeoutRow( Text( text = formattedTime, style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } @@ -641,9 +639,11 @@ private fun SessionTimeoutActionRow( Text( text = selectedVaultTimeoutAction.displayLabel(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant.copy( - alpha = if (isEnabled) 1.0f else 0.38f, - ), + color = if (isEnabled) { + BitwardenTheme.colorScheme.text.primary + } else { + BitwardenTheme.colorScheme.filledButton.foregroundDisabled + }, modifier = Modifier.testTag("SessionTimeoutActionStatusLabel"), ) } @@ -737,7 +737,7 @@ private fun FingerPrintPhraseDialog( title = { Text( text = stringResource(id = R.string.fingerprint_phrase), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.headlineSmall, modifier = Modifier.fillMaxWidth(), ) @@ -746,19 +746,22 @@ private fun FingerPrintPhraseDialog( Column { Text( text = "${stringResource(id = R.string.your_accounts_fingerprint)}:", - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, modifier = Modifier.fillMaxWidth(), ) Spacer(modifier = Modifier.height(24.dp)) Text( text = fingerprintPhrase(), - color = LocalNonMaterialColors.current.fingerprint, + color = BitwardenTheme.colorScheme.text.codePink, style = BitwardenTheme.typography.sensitiveInfoSmall, modifier = Modifier.fillMaxWidth(), ) } }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/PinInputDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/PinInputDialog.kt index 52d8f5f278..34bbe83bec 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/PinInputDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/PinInputDialog.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -70,7 +69,7 @@ fun PinInputDialog( ) // This background is necessary for the dialog to not be transparent. .background( - color = MaterialTheme.colorScheme.surfaceContainerHigh, + color = BitwardenTheme.colorScheme.background.primary, shape = RoundedCornerShape(28.dp), ), horizontalAlignment = Alignment.End, @@ -82,7 +81,7 @@ fun PinInputDialog( .padding(horizontal = 24.dp) .fillMaxWidth(), text = stringResource(id = R.string.enter_pin), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.headlineSmall, ) Spacer(modifier = Modifier.height(height = 16.dp)) @@ -100,7 +99,7 @@ fun PinInputDialog( .testTag(tag = "AlertContentText") .fillMaxWidth(), text = stringResource(id = R.string.set_pin_description), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, ) Spacer(modifier = Modifier.height(height = 16.dp)) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt index ccc15e6fbc..42e5b32f92 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -35,7 +34,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledErrorButton -import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton +import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedErrorButton import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog @@ -131,14 +130,14 @@ fun DeleteAccountScreen( Icon( painter = rememberVectorPainter(id = R.drawable.ic_warning), contentDescription = null, - tint = MaterialTheme.colorScheme.error, + tint = BitwardenTheme.colorScheme.status.error, modifier = Modifier.padding(horizontal = 16.dp), ) Spacer(modifier = Modifier.height(8.dp)) Text( text = stringResource(id = R.string.deleting_your_account_is_permanent), style = BitwardenTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.error, + color = BitwardenTheme.colorScheme.status.error, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -147,7 +146,7 @@ fun DeleteAccountScreen( Text( text = stringResource(id = R.string.delete_account_explanation), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -171,7 +170,7 @@ fun DeleteAccountScreen( .padding(horizontal = 16.dp), ) Spacer(modifier = Modifier.height(12.dp)) - BitwardenOutlinedButton( + BitwardenOutlinedErrorButton( label = stringResource(id = R.string.cancel), onClick = remember(viewModel) { { viewModel.trySendAction(DeleteAccountAction.CancelClick) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt index e7e228d959..3f6c8f82f0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -148,7 +147,7 @@ private fun DeleteAccountConfirmationContent( text = stringResource(id = R.string.a_verification_code_was_sent_to_your_email), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -170,7 +169,7 @@ private fun DeleteAccountConfirmationContent( text = stringResource(id = R.string.confirm_your_identity), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt index d2b526866b..76abceaf5d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -45,7 +44,6 @@ import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.composition.LocalExitManager import com.x8bit.bitwarden.ui.platform.manager.exit.ExitManager import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors /** * Displays the login approval screen. @@ -160,7 +158,7 @@ private fun LoginApprovalContent( Text( text = stringResource(id = R.string.are_you_trying_to_log_in), style = BitwardenTheme.typography.headlineMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -173,7 +171,7 @@ private fun LoginApprovalContent( state.domainUrl, ), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp) @@ -184,7 +182,7 @@ private fun LoginApprovalContent( Text( text = stringResource(id = R.string.fingerprint_phrase), style = BitwardenTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -194,7 +192,7 @@ private fun LoginApprovalContent( Text( text = state.fingerprint, textAlign = TextAlign.Start, - color = LocalNonMaterialColors.current.fingerprint, + color = BitwardenTheme.colorScheme.text.codePink, style = BitwardenTheme.typography.sensitiveInfoSmall, modifier = Modifier .testTag("FingerprintValueLabel") @@ -260,7 +258,7 @@ private fun LoginApprovalInfoColumn( Text( text = label, style = BitwardenTheme.typography.titleSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -271,7 +269,7 @@ private fun LoginApprovalInfoColumn( Text( text = value, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt index d7856b5f0e..817475a0cb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt @@ -18,7 +18,6 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -52,7 +51,6 @@ import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.scaffold.rememberBitwardenPullToRefreshState import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme -import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialColors /** * Displays the pending login requests screen. @@ -240,7 +238,9 @@ private fun PendingRequestItem( modifier = modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onNavigateToLoginApproval(fingerprintPhrase) }, ), horizontalAlignment = Alignment.Start, @@ -250,7 +250,7 @@ private fun PendingRequestItem( Text( text = stringResource(id = R.string.fingerprint_phrase), style = BitwardenTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Start, modifier = Modifier .fillMaxWidth() @@ -261,7 +261,7 @@ private fun PendingRequestItem( Text( text = fingerprintPhrase, - color = LocalNonMaterialColors.current.fingerprint, + color = BitwardenTheme.colorScheme.text.codePink, style = BitwardenTheme.typography.sensitiveInfoSmall, textAlign = TextAlign.Start, modifier = Modifier @@ -280,14 +280,14 @@ private fun PendingRequestItem( Text( text = platform, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, textAlign = TextAlign.Start, modifier = Modifier.padding(horizontal = 16.dp), ) Text( text = timestamp, style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, textAlign = TextAlign.End, modifier = Modifier.padding(horizontal = 16.dp), ) @@ -323,7 +323,7 @@ private fun PendingRequestsEmpty( Text( text = stringResource(id = R.string.no_pending_requests), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/appearance/AppearanceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/appearance/AppearanceScreen.kt index db8aec5c9c..504fcb053d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/appearance/AppearanceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/appearance/AppearanceScreen.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -141,7 +140,7 @@ private fun LanguageSelectionRow( Text( text = currentSelection.text(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } @@ -185,7 +184,7 @@ private fun ThemeSelectionRow( Text( text = currentSelection.displayLabel(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt index 6ed73005ff..ccfc656358 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -295,7 +294,7 @@ private fun DefaultUriMatchTypeRow( Text( text = selectedUriMatchType.displayLabel(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/AddEditBlockedUriDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/AddEditBlockedUriDialog.kt index d037be2c8c..01c477e44e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/AddEditBlockedUriDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/AddEditBlockedUriDialog.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.platform.feature.settings.autofill.blockautofill import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -12,7 +11,6 @@ import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -25,6 +23,7 @@ import androidx.compose.ui.window.Dialog import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton +import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.util.maxDialogHeight import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -56,7 +55,7 @@ fun AddEditBlockedUriDialog( ) // This background is necessary for the dialog to not be transparent. .background( - color = MaterialTheme.colorScheme.surfaceContainerHigh, + color = BitwardenTheme.colorScheme.background.primary, shape = RoundedCornerShape(28.dp), ), horizontalAlignment = Alignment.End, @@ -66,16 +65,11 @@ fun AddEditBlockedUriDialog( .padding(top = 24.dp, start = 24.dp, end = 24.dp) .fillMaxWidth(), text = stringResource(id = R.string.new_uri), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.headlineSmall, ) if (scrollState.canScrollBackward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } Spacer(modifier = Modifier.height(8.dp)) @@ -101,12 +95,7 @@ fun AddEditBlockedUriDialog( ) } if (scrollState.canScrollForward) { - Box( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(MaterialTheme.colorScheme.outlineVariant), - ) + BitwardenHorizontalDivider() } Row( verticalAlignment = Alignment.CenterVertically, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/BlockAutoFillScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/BlockAutoFillScreen.kt index 9f8301d610..560d6ea784 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/BlockAutoFillScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/blockautofill/BlockAutoFillScreen.kt @@ -20,7 +20,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -162,7 +161,7 @@ fun BlockAutoFillScreen( text = stringResource( id = R.string.auto_fill_will_not_be_offered_for_these_ur_is, ), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, modifier = Modifier.align(Alignment.CenterVertically), ) @@ -222,7 +221,7 @@ private fun BlockAutoFillNoItems( id = R.drawable.ic_blocked_uri_background, ), contentDescription = null, - tint = MaterialTheme.colorScheme.surfaceVariant, + tint = BitwardenTheme.colorScheme.icon.reversed, ) Icon( @@ -230,7 +229,7 @@ private fun BlockAutoFillNoItems( id = R.drawable.ic_blocked_uri_foreground, ), contentDescription = null, - tint = MaterialTheme.colorScheme.outline, + tint = BitwardenTheme.colorScheme.icon.primary, ) } @@ -267,7 +266,9 @@ private fun BlockAutoFillListItem( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onClick, ) .bottomDivider(paddingStart = 16.dp) @@ -283,12 +284,12 @@ private fun BlockAutoFillListItem( .weight(1f), text = label, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) Icon( painter = rememberVectorPainter(id = R.drawable.ic_edit_alt), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier.size(24.dp), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt index 406b1eb7f3..cfd5057a14 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -283,7 +282,7 @@ private fun ExportVaultScreenContent( text = stringResource(id = R.string.send_verification_code_to_email), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), @@ -334,7 +333,7 @@ private fun ExportVaultScreenContent( text = stringResource(id = R.string.export_vault_master_password_description), textAlign = TextAlign.Start, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt index 7eab71abe7..f7101a0fc1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -149,7 +148,7 @@ private fun FoldersContent( text = stringResource(id = R.string.no_folders_to_list), textAlign = TextAlign.Center, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.testTag("NoFoldersLabel"), ) } @@ -163,7 +162,9 @@ private fun FoldersContent( .testTag("FolderCell") .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = { onItemClick(it.id) }, ) .bottomDivider(paddingStart = 16.dp) @@ -179,7 +180,7 @@ private fun FoldersContent( .weight(1f), text = it.name, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt index 4de872f485..e8428ec031 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState import androidx.compose.runtime.Composable @@ -40,6 +39,7 @@ import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import kotlinx.collections.immutable.persistentListOf /** @@ -85,7 +85,7 @@ fun FolderAddEditScreen( viewModel.trySendAction(FolderAddEditAction.DeleteClick) }, onDismissRequest = { shouldShowConfirmationDialog = false }, - confirmTextColor = MaterialTheme.colorScheme.error, + confirmTextColor = BitwardenTheme.colorScheme.status.error, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/other/OtherScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/other/OtherScreen.kt index 4db2de3384..68003c96bb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/other/OtherScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/other/OtherScreen.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState @@ -140,11 +139,13 @@ fun OtherScreen( Text( text = stringResource(id = R.string.last_sync), style = BitwardenTheme.typography.bodySmall, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.padding(start = 16.dp, end = 2.dp), ) Text( text = state.lastSyncTime, style = BitwardenTheme.typography.bodySmall, + color = BitwardenTheme.colorScheme.text.secondary, ) } @@ -228,7 +229,7 @@ private fun ClearClipboardFrequencyRow( Text( text = currentSelection.displayLabel.invoke(), style = BitwardenTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.testTag("ClearClipboardAfterLabel"), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt index 30405bac22..2401b7389a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBars import androidx.compose.material3.BottomAppBar -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ScaffoldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -45,6 +44,7 @@ import com.x8bit.bitwarden.ui.platform.feature.search.model.SearchType import com.x8bit.bitwarden.ui.platform.feature.settings.navigateToSettingsGraph import com.x8bit.bitwarden.ui.platform.feature.settings.settingsGraph import com.x8bit.bitwarden.ui.platform.feature.vaultunlockednavbar.model.VaultUnlockedNavBarTab +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.theme.RootTransitionProviders import com.x8bit.bitwarden.ui.tools.feature.generator.generatorGraph import com.x8bit.bitwarden.ui.tools.feature.generator.navigateToGeneratorGraph @@ -250,7 +250,7 @@ private fun VaultBottomAppBar( modifier: Modifier = Modifier, ) { BottomAppBar( - containerColor = MaterialTheme.colorScheme.surfaceContainer, + containerColor = BitwardenTheme.colorScheme.background.secondary, modifier = modifier, ) { val destinations = listOf( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt index 2d53eac908..42eada303c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt @@ -1,12 +1,9 @@ package com.x8bit.bitwarden.ui.platform.theme import android.app.Activity -import android.content.Context import android.graphics.drawable.ColorDrawable import android.os.Build -import androidx.annotation.ColorRes import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.ColorScheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.dynamicDarkColorScheme @@ -18,16 +15,15 @@ import androidx.compose.runtime.ProvidableCompositionLocal import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.SideEffect import androidx.compose.runtime.compositionLocalOf -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalView import androidx.core.view.WindowCompat -import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.feature.settings.appearance.model.AppTheme import com.x8bit.bitwarden.ui.platform.theme.color.BitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.darkBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.dynamicBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.lightBitwardenColorScheme +import com.x8bit.bitwarden.ui.platform.theme.color.toMaterialColorScheme import com.x8bit.bitwarden.ui.platform.theme.type.BitwardenTypography import com.x8bit.bitwarden.ui.platform.theme.type.bitwardenTypography import com.x8bit.bitwarden.ui.platform.theme.type.toMaterialTypography @@ -56,7 +52,6 @@ object BitwardenTheme { /** * The overall application theme. This can be configured to support a [theme] and [dynamicColor]. */ -@Suppress("CyclomaticComplexMethod") @Composable fun BitwardenTheme( theme: AppTheme = AppTheme.DEFAULT, @@ -71,22 +66,22 @@ fun BitwardenTheme( // Get the current scheme val context = LocalContext.current - val colorScheme = when { + val materialColorScheme = when { dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + if (darkTheme) { + dynamicDarkColorScheme(context = context) + } else { + dynamicLightColorScheme(context = context) + } } - darkTheme -> darkColorScheme(context) - else -> lightColorScheme(context) + darkTheme -> darkColorScheme() + else -> lightColorScheme() } val bitwardenColorScheme = when { dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { dynamicBitwardenColorScheme( - materialColorScheme = if (darkTheme) { - dynamicDarkColorScheme(context = context) - } else { - dynamicLightColorScheme(context = context) - }, + materialColorScheme = materialColorScheme, isDarkTheme = darkTheme, ) } @@ -104,154 +99,32 @@ fun BitwardenTheme( val insetsController = WindowCompat.getInsetsController(window, view) insetsController.isAppearanceLightStatusBars = !darkTheme insetsController.isAppearanceLightNavigationBars = !darkTheme - window.setBackgroundDrawable(ColorDrawable(colorScheme.surface.value.toInt())) + window.setBackgroundDrawable( + ColorDrawable(bitwardenColorScheme.background.primary.value.toInt()), + ) } } - val nonMaterialColors = if (darkTheme) { - darkNonMaterialColors(context) - } else { - lightNonMaterialColors(context) - } - CompositionLocalProvider( LocalBitwardenColorScheme provides bitwardenColorScheme, - LocalNonMaterialColors provides nonMaterialColors, LocalBitwardenTypography provides bitwardenTypography, ) { - // Set overall theme based on color scheme and typography settings MaterialTheme( - colorScheme = colorScheme, + colorScheme = bitwardenColorScheme.toMaterialColorScheme( + defaultColorScheme = materialColorScheme, + ), typography = bitwardenTypography.toMaterialTypography(), content = content, ) } } -private fun darkColorScheme(context: Context): ColorScheme = - darkColorScheme( - primary = R.color.dark_primary.toColor(context), - onPrimary = R.color.dark_on_primary.toColor(context), - primaryContainer = R.color.dark_primary_container.toColor(context), - onPrimaryContainer = R.color.dark_on_primary_container.toColor(context), - secondary = R.color.dark_secondary.toColor(context), - onSecondary = R.color.dark_on_secondary.toColor(context), - secondaryContainer = R.color.dark_secondary_container.toColor(context), - onSecondaryContainer = R.color.dark_on_secondary_container.toColor(context), - tertiary = R.color.dark_tertiary.toColor(context), - onTertiary = R.color.dark_on_tertiary.toColor(context), - tertiaryContainer = R.color.dark_tertiary_container.toColor(context), - onTertiaryContainer = R.color.dark_on_tertiary_container.toColor(context), - error = R.color.dark_error.toColor(context), - onError = R.color.dark_on_error.toColor(context), - errorContainer = R.color.dark_error_container.toColor(context), - onErrorContainer = R.color.dark_on_error_container.toColor(context), - surface = R.color.dark_surface.toColor(context), - surfaceBright = R.color.dark_surface_bright.toColor(context), - surfaceContainer = R.color.dark_surface_container.toColor(context), - surfaceContainerHigh = R.color.dark_surface_container_high.toColor(context), - surfaceContainerHighest = R.color.dark_surface_container_highest.toColor(context), - surfaceContainerLow = R.color.dark_surface_container_low.toColor(context), - surfaceContainerLowest = R.color.dark_surface_container_lowest.toColor(context), - surfaceVariant = R.color.dark_surface_variant.toColor(context), - surfaceDim = R.color.dark_surface_dim.toColor(context), - onSurface = R.color.dark_on_surface.toColor(context), - onSurfaceVariant = R.color.dark_on_surface_variant.toColor(context), - outline = R.color.dark_outline.toColor(context), - outlineVariant = R.color.dark_outline_variant.toColor(context), - inverseSurface = R.color.dark_inverse_surface.toColor(context), - inverseOnSurface = R.color.dark_inverse_on_surface.toColor(context), - inversePrimary = R.color.dark_inverse_primary.toColor(context), - scrim = R.color.dark_scrim.toColor(context), - ) - -private fun lightColorScheme(context: Context): ColorScheme = - lightColorScheme( - primary = R.color.primary.toColor(context), - onPrimary = R.color.on_primary.toColor(context), - primaryContainer = R.color.primary_container.toColor(context), - onPrimaryContainer = R.color.on_primary_container.toColor(context), - secondary = R.color.secondary.toColor(context), - onSecondary = R.color.on_secondary.toColor(context), - secondaryContainer = R.color.secondary_container.toColor(context), - onSecondaryContainer = R.color.on_secondary_container.toColor(context), - tertiary = R.color.tertiary.toColor(context), - onTertiary = R.color.on_tertiary.toColor(context), - tertiaryContainer = R.color.tertiary_container.toColor(context), - onTertiaryContainer = R.color.on_tertiary_container.toColor(context), - error = R.color.error.toColor(context), - onError = R.color.on_error.toColor(context), - errorContainer = R.color.error_container.toColor(context), - onErrorContainer = R.color.on_error_container.toColor(context), - surface = R.color.surface.toColor(context), - surfaceBright = R.color.surface_bright.toColor(context), - surfaceContainer = R.color.surface_container.toColor(context), - surfaceContainerHigh = R.color.surface_container_high.toColor(context), - surfaceContainerHighest = R.color.surface_container_highest.toColor(context), - surfaceContainerLow = R.color.surface_container_low.toColor(context), - surfaceContainerLowest = R.color.surface_container_lowest.toColor(context), - surfaceVariant = R.color.surface_variant.toColor(context), - surfaceDim = R.color.surface_dim.toColor(context), - onSurface = R.color.on_surface.toColor(context), - onSurfaceVariant = R.color.on_surface_variant.toColor(context), - outline = R.color.outline.toColor(context), - outlineVariant = R.color.outline_variant.toColor(context), - inverseSurface = R.color.inverse_surface.toColor(context), - inverseOnSurface = R.color.inverse_on_surface.toColor(context), - inversePrimary = R.color.inverse_primary.toColor(context), - scrim = R.color.scrim.toColor(context), - ) - -@ColorRes -private fun Int.toColor(context: Context): Color = Color(context.getColor(this)) - /** * Provides access to the Bitwarden typography throughout the app. */ val LocalBitwardenTypography: ProvidableCompositionLocal = compositionLocalOf { bitwardenTypography } -/** - * Provides access to non material theme colors throughout the app. - */ -val LocalNonMaterialColors: ProvidableCompositionLocal = - compositionLocalOf { - // Default value here will immediately be overridden in BitwardenTheme, similar - // to how MaterialTheme works. - NonMaterialColors( - fingerprint = Color.Transparent, - passwordWeak = Color.Transparent, - passwordStrong = Color.Transparent, - qrCodeClickableText = Color.Transparent, - ) - } - -/** - * Models colors that live outside of the Material Theme spec. - */ -data class NonMaterialColors( - val fingerprint: Color, - val passwordWeak: Color, - val passwordStrong: Color, - val qrCodeClickableText: Color, -) - -private fun lightNonMaterialColors(context: Context): NonMaterialColors = - NonMaterialColors( - fingerprint = R.color.light_fingerprint.toColor(context), - passwordWeak = R.color.light_password_strength_weak.toColor(context), - passwordStrong = R.color.light_password_strength_strong.toColor(context), - qrCodeClickableText = R.color.qr_code_clickable_text.toColor(context), - ) - -private fun darkNonMaterialColors(context: Context): NonMaterialColors = - NonMaterialColors( - fingerprint = R.color.dark_fingerprint.toColor(context), - passwordWeak = R.color.dark_password_strength_weak.toColor(context), - passwordStrong = R.color.dark_password_strength_strong.toColor(context), - qrCodeClickableText = R.color.qr_code_clickable_text.toColor(context), - ) - /** * Provides access to the Bitwarden colors throughout the app. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/color/ColorScheme.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/color/ColorScheme.kt index 4ff0c02fa6..9cf7d4c768 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/color/ColorScheme.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/color/ColorScheme.kt @@ -162,59 +162,59 @@ fun dynamicBitwardenColorScheme( val defaultTheme = if (isDarkTheme) darkBitwardenColorScheme else lightBitwardenColorScheme return BitwardenColorScheme( text = BitwardenColorScheme.TextColors( - primary = materialColorScheme.onSurface, - secondary = materialColorScheme.onSecondaryContainer, + primary = materialColorScheme.onBackground, + secondary = materialColorScheme.onSurface, interaction = materialColorScheme.primary, reversed = materialColorScheme.onTertiary, codePink = defaultTheme.text.codePink, codeBlue = defaultTheme.text.codeBlue, ), background = BitwardenColorScheme.BackgroundColors( - primary = materialColorScheme.surface, - secondary = materialColorScheme.secondary, - tertiary = materialColorScheme.tertiary, + primary = materialColorScheme.background, + secondary = materialColorScheme.surfaceContainer, + tertiary = materialColorScheme.surfaceContainerHighest, alert = materialColorScheme.error, scrim = materialColorScheme.scrim, pressed = materialColorScheme.onSurfaceVariant, ), stroke = BitwardenColorScheme.StrokeColors( - divider = materialColorScheme.outline, + divider = materialColorScheme.outlineVariant, border = materialColorScheme.primary, segmentedNav = materialColorScheme.outline, ), icon = BitwardenColorScheme.IconColors( - primary = materialColorScheme.onPrimary, - secondary = materialColorScheme.onSecondary, + primary = materialColorScheme.onBackground, + secondary = materialColorScheme.primary, reversed = materialColorScheme.inversePrimary, badgeBackground = materialColorScheme.error, badgeForeground = materialColorScheme.onError, ), filledButton = BitwardenColorScheme.FilledButtonColors( - background = materialColorScheme.surface, + background = materialColorScheme.primary, backgroundDisabled = materialColorScheme.onSurface.copy(alpha = 0.12f), - backgroundReversed = materialColorScheme.inversePrimary, - foreground = materialColorScheme.onSurface, + backgroundReversed = materialColorScheme.surfaceContainerHighest, + foreground = materialColorScheme.onPrimary, foregroundDisabled = materialColorScheme.onSurface.copy(alpha = 0.38f), - foregroundReversed = materialColorScheme.inverseOnSurface, + foregroundReversed = materialColorScheme.onSurface, ), outlineButton = BitwardenColorScheme.OutlineButtonColors( - border = materialColorScheme.outline, + border = materialColorScheme.outlineVariant, borderDisabled = materialColorScheme.outlineVariant, borderReversed = materialColorScheme.outlineVariant, - foreground = materialColorScheme.outlineVariant, - foregroundDisabled = materialColorScheme.outlineVariant, - foregroundReversed = materialColorScheme.outlineVariant, + foreground = materialColorScheme.primary, + foregroundDisabled = materialColorScheme.onSurface, + foregroundReversed = materialColorScheme.inversePrimary, ), tonalButton = BitwardenColorScheme.TonalButtonColors( - background = materialColorScheme.secondaryContainer, + background = materialColorScheme.primary, backgroundDisabled = materialColorScheme.onSurface.copy(alpha = 0.12f), - foreground = materialColorScheme.onSecondaryContainer, + foreground = materialColorScheme.onPrimary, foregroundDisabled = materialColorScheme.onSurface.copy(alpha = 0.38f), ), toggleButton = BitwardenColorScheme.ToggleButtonColors( backgroundOn = materialColorScheme.primary, backgroundOff = materialColorScheme.surfaceContainerHighest, - switch = materialColorScheme.onPrimary, + switch = materialColorScheme.onPrimaryContainer, ), sliderButton = BitwardenColorScheme.SliderButtonColors( knobBackground = materialColorScheme.primary, @@ -232,6 +232,17 @@ fun dynamicBitwardenColorScheme( ) } +/** + * Derives a Material [ColorScheme] from the [BitwardenColorScheme] using the [defaultColorScheme] + * as a baseline. + */ +fun BitwardenColorScheme.toMaterialColorScheme( + defaultColorScheme: ColorScheme, +): ColorScheme = defaultColorScheme.copy( + primary = this.stroke.border, + onSurfaceVariant = this.text.secondary, +) + /** * The raw colors that support the [BitwardenColorScheme]. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/passwordhistory/PasswordHistoryListItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/passwordhistory/PasswordHistoryListItem.kt index 9d8954261e..58fe7624d8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/passwordhistory/PasswordHistoryListItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/passwordhistory/PasswordHistoryListItem.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -58,7 +57,7 @@ fun PasswordHistoryListItem( visualTransformation = nonLetterColorVisualTransformation(), ), style = textStyle, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .testTag("GeneratedPasswordValue") .fillMaxWidth() @@ -68,7 +67,7 @@ fun PasswordHistoryListItem( Text( text = supportingLabel, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier.testTag("GeneratedPasswordDateLabel"), ) } @@ -77,7 +76,7 @@ fun PasswordHistoryListItem( vectorIconRes = R.drawable.ic_copy, contentDescription = stringResource(id = R.string.copy), onClick = onCopyClick, - contentColor = MaterialTheme.colorScheme.primary, + contentColor = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier.testTag(tag = "CopyPasswordValueButton"), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendContent.kt index 6366943671..3536c14fb4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendContent.kt @@ -19,7 +19,6 @@ import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -151,7 +150,7 @@ fun AddSendContent( if (isShared) { Text( text = type.name.orEmpty(), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, modifier = Modifier .fillMaxWidth() @@ -160,7 +159,7 @@ fun AddSendContent( Spacer(modifier = Modifier.height(8.dp)) Text( text = stringResource(id = R.string.max_file_size), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, modifier = Modifier .fillMaxWidth() @@ -172,7 +171,7 @@ fun AddSendContent( .testTag("SendCurrentFileNameLabel") .align(Alignment.CenterHorizontally), text = type.name ?: stringResource(id = R.string.no_file_chosen), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, ) Spacer(modifier = Modifier.height(8.dp)) @@ -195,7 +194,7 @@ fun AddSendContent( Spacer(modifier = Modifier.height(4.dp)) Text( text = stringResource(id = R.string.max_file_size), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, modifier = Modifier .fillMaxWidth() @@ -204,7 +203,7 @@ fun AddSendContent( Spacer(modifier = Modifier.height(16.dp)) Text( text = stringResource(id = R.string.type_file_info), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, modifier = Modifier .fillMaxWidth() @@ -218,14 +217,14 @@ fun AddSendContent( ) { Text( text = type.name.orEmpty(), - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyLarge, modifier = Modifier.weight(1f), ) Spacer(modifier = Modifier.width(8.dp)) Text( text = type.displaySize.orEmpty(), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, ) } @@ -309,7 +308,7 @@ private fun AddSendOptions( ) { Text( text = stringResource(id = R.string.options), - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, style = BitwardenTheme.typography.labelLarge, modifier = Modifier.padding(end = 8.dp), ) @@ -322,7 +321,7 @@ private fun AddSendOptions( }, ), contentDescription = null, - tint = MaterialTheme.colorScheme.primary, + tint = BitwardenTheme.colorScheme.icon.secondary, ) } // Hide all content if not expanded: @@ -382,7 +381,7 @@ private fun AddSendOptions( Text( text = stringResource(id = R.string.deletion_date_info), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), @@ -419,7 +418,7 @@ private fun AddSendOptions( Text( text = stringResource(id = R.string.expiration_date_info), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier.weight(1f), ) Spacer(modifier = Modifier.width(4.dp)) @@ -451,7 +450,7 @@ private fun AddSendOptions( Text( text = stringResource(id = R.string.maximum_access_count_info), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 32.dp), @@ -467,13 +466,13 @@ private fun AddSendOptions( Text( text = stringResource(id = R.string.current_access_count) + ":", style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) Spacer(modifier = Modifier.width(4.dp)) Text( text = it.toString(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } Spacer(modifier = Modifier.height(16.dp)) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendDeletionDateChooser.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendDeletionDateChooser.kt index 3f8b1b5f3e..34e87a4c2c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendDeletionDateChooser.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendDeletionDateChooser.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -81,7 +80,7 @@ fun SendDeletionDateChooser( Text( text = stringResource(id = R.string.deletion_date_info), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendExpirationDateChooser.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendExpirationDateChooser.kt index c7ec9d4ace..b3615ee3d7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendExpirationDateChooser.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendExpirationDateChooser.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -83,7 +82,7 @@ fun SendExpirationDateChooser( Text( text = stringResource(id = R.string.expiration_date_info), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/components/CollectionItemSelector.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/components/CollectionItemSelector.kt index 2a8148d9b6..819420a9ca 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/components/CollectionItemSelector.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/components/CollectionItemSelector.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -68,7 +67,7 @@ fun LazyListScope.collectionItemsSelector( Text( text = stringResource(id = R.string.no_collections_to_list), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt index 75120d3386..8d1dfd84ef 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable @@ -25,6 +24,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitchWithActions +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.vault.components.collectionItemsSelector import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditCardTypeHandlers import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditCommonHandlers @@ -229,7 +229,7 @@ fun LazyListScope.vaultAddEditCardItems( id = R.string.master_password_re_prompt_help, ), onClick = commonHandlers.onTooltipClick, - contentColor = MaterialTheme.colorScheme.onSurface, + contentColor = BitwardenTheme.colorScheme.icon.secondary, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt index 90785f33f7..26407132b4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext @@ -20,6 +19,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitchWithActions +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.vault.components.collectionItemsSelector import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditCommonHandlers import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditIdentityTypeHandlers @@ -330,7 +330,7 @@ fun LazyListScope.vaultAddEditIdentityItems( id = R.string.master_password_re_prompt_help, ), onClick = commonTypeHandlers.onTooltipClick, - contentColor = MaterialTheme.colorScheme.onSurface, + contentColor = BitwardenTheme.colorScheme.icon.secondary, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt index 3ebd3dd87f..abfd8531d3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -33,6 +32,7 @@ import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitchWithActions import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.vault.components.collectionItemsSelector import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditCommonHandlers import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditLoginTypeHandlers @@ -251,7 +251,7 @@ fun LazyListScope.vaultAddEditLoginItems( id = R.string.master_password_re_prompt_help, ), onClick = commonActionHandler.onTooltipClick, - contentColor = MaterialTheme.colorScheme.onSurface, + contentColor = BitwardenTheme.colorScheme.icon.secondary, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt index 9c2661901d..f690b21a16 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource @@ -18,6 +17,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitchWithActions +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.vault.components.collectionItemsSelector import com.x8bit.bitwarden.ui.vault.feature.addedit.handlers.VaultAddEditCommonHandlers import com.x8bit.bitwarden.ui.vault.feature.addedit.model.CustomFieldType @@ -109,7 +109,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems( id = R.string.master_password_re_prompt_help, ), onClick = commonTypeHandlers.onTooltipClick, - contentColor = MaterialTheme.colorScheme.onSurface, + contentColor = BitwardenTheme.colorScheme.icon.secondary, ) }, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsContent.kt index 287eb20728..089ac0d516 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsContent.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -50,7 +49,7 @@ fun AttachmentsContent( Text( text = stringResource(id = R.string.no_attachments), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, textAlign = TextAlign.Center, modifier = Modifier .testTag("NoAttachmentsLabel") @@ -88,7 +87,7 @@ fun AttachmentsContent( .newAttachment ?.displayName ?: stringResource(id = R.string.no_file_chosen), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, textAlign = TextAlign.Center, modifier = Modifier @@ -109,7 +108,7 @@ fun AttachmentsContent( Spacer(modifier = Modifier.height(4.dp)) Text( text = stringResource(id = R.string.max_file_size), - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, style = BitwardenTheme.typography.bodySmall, modifier = Modifier .fillMaxWidth() @@ -147,10 +146,7 @@ private fun AttachmentListEntry( Row( modifier = Modifier - .bottomDivider( - paddingStart = 16.dp, - color = MaterialTheme.colorScheme.outlineVariant, - ) + .bottomDivider(paddingStart = 16.dp) .defaultMinSize(minHeight = 56.dp) .testTag("AttachmentRow") .padding(vertical = 8.dp) @@ -159,7 +155,7 @@ private fun AttachmentListEntry( ) { Text( text = attachmentItem.title, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -170,7 +166,7 @@ private fun AttachmentListEntry( Text( text = attachmentItem.displaySize, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.labelSmall, modifier = Modifier, ) @@ -181,7 +177,6 @@ private fun AttachmentListEntry( vectorIconRes = R.drawable.ic_trash, contentDescription = stringResource(id = R.string.delete), onClick = { shouldShowDeleteDialog = true }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemAttachmentContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemAttachmentContent.kt index fec97c2712..1df2c1d6e5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemAttachmentContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemAttachmentContent.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.AlertDialog -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -39,16 +38,14 @@ fun AttachmentItemContent( var shouldShowSizeWarningDialog by rememberSaveable { mutableStateOf(false) } Row( modifier = modifier - .bottomDivider( - color = MaterialTheme.colorScheme.outlineVariant, - ) + .bottomDivider() .defaultMinSize(minHeight = 56.dp) .padding(vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, ) { Text( text = attachmentItem.title, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.bodyMedium, maxLines = 1, overflow = TextOverflow.Ellipsis, @@ -59,7 +56,7 @@ fun AttachmentItemContent( Text( text = attachmentItem.displaySize, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, style = BitwardenTheme.typography.labelSmall, modifier = Modifier, ) @@ -82,7 +79,6 @@ fun AttachmentItemContent( onAttachmentDownloadClick(attachmentItem) }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, ) } @@ -101,7 +97,10 @@ fun AttachmentItemContent( style = BitwardenTheme.typography.bodyMedium, ) }, - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + containerColor = BitwardenTheme.colorScheme.background.primary, + iconContentColor = BitwardenTheme.colorScheme.icon.secondary, + titleContentColor = BitwardenTheme.colorScheme.text.primary, + textContentColor = BitwardenTheme.colorScheme.text.primary, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemLoginContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemLoginContent.kt index db623b66fd..73045d8bb4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemLoginContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemLoginContent.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -346,12 +345,12 @@ private fun PasswordHistoryCount( Text( text = "${stringResource(id = R.string.password_history)}: ", style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) Text( text = passwordHistoryCount.toString(), style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.primary, + color = BitwardenTheme.colorScheme.text.interaction, modifier = Modifier.clickable(onClick = onPasswordHistoryClick), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSecureNoteContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSecureNoteContent.kt index c2f0841451..7fbbdfc644 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSecureNoteContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSecureNoteContent.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -141,12 +140,12 @@ fun VaultItemSecureNoteContent( Text( text = "${stringResource(id = R.string.date_updated)}: ", style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) Text( text = commonState.lastUpdated, style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemUpdateText.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemUpdateText.kt index 464f215215..0b19bf986f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemUpdateText.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemUpdateText.kt @@ -1,7 +1,6 @@ package com.x8bit.bitwarden.ui.vault.feature.item import androidx.compose.foundation.layout.Row -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -24,12 +23,12 @@ fun VaultItemUpdateText( Text( text = header, style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) Text( text = text, style = BitwardenTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationContent.kt index 62d3ca5b06..103fe932d6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationContent.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -14,7 +13,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.dropdown.BitwardenMultiSelectButton import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @@ -65,9 +63,8 @@ fun VaultMoveToOrganizationContent( Column(horizontalAlignment = Alignment.CenterHorizontally) { Text( text = stringResource(id = R.string.move_to_org_desc), - style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, - fontSize = 12.sp, + style = BitwardenTheme.typography.bodySmall, + color = BitwardenTheme.colorScheme.text.secondary, modifier = Modifier .fillMaxWidth() .padding(horizontal = 32.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationEmpty.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationEmpty.kt index 89e72e4238..2946b03ba3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationEmpty.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationEmpty.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -29,7 +28,7 @@ fun VaultMoveToOrganizationEmpty(modifier: Modifier = Modifier) { Text( text = stringResource(id = R.string.no_orgs_to_list), style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.secondary, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/qrcodescan/QrCodeScanScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/qrcodescan/QrCodeScanScreen.kt index 6e12e12650..4046598e4c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/qrcodescan/QrCodeScanScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/qrcodescan/QrCodeScanScreen.kt @@ -25,11 +25,11 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -59,6 +59,8 @@ import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.text.BitwardenClickableText import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme +import com.x8bit.bitwarden.ui.platform.theme.LocalBitwardenColorScheme +import com.x8bit.bitwarden.ui.platform.theme.color.darkBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.util.isPortrait import com.x8bit.bitwarden.ui.vault.feature.qrcodescan.util.QrCodeAnalyzer import com.x8bit.bitwarden.ui.vault.feature.qrcodescan.util.QrCodeAnalyzerImpl @@ -105,39 +107,43 @@ fun QrCodeScanScreen( } } } - - BitwardenScaffold( - modifier = Modifier.fillMaxSize(), - topBar = { - BitwardenTopAppBar( - title = stringResource(id = R.string.scan_qr_code), - navigationIcon = rememberVectorPainter(id = R.drawable.ic_close), - navigationIconContentDescription = stringResource(id = R.string.close), - onNavigationIconClick = remember(viewModel) { - { viewModel.trySendAction(QrCodeScanAction.CloseClick) } - }, - scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()), - ) - }, - ) { innerPadding -> - CameraPreview( - cameraErrorReceive = remember(viewModel) { - { viewModel.trySendAction(QrCodeScanAction.CameraSetupErrorReceive) } + // This screen should always look like it's in dark mode + CompositionLocalProvider(LocalBitwardenColorScheme provides darkBitwardenColorScheme) { + BitwardenScaffold( + modifier = Modifier.fillMaxSize(), + topBar = { + BitwardenTopAppBar( + title = stringResource(id = R.string.scan_qr_code), + navigationIcon = rememberVectorPainter(id = R.drawable.ic_close), + navigationIconContentDescription = stringResource(id = R.string.close), + onNavigationIconClick = remember(viewModel) { + { viewModel.trySendAction(QrCodeScanAction.CloseClick) } + }, + scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior( + state = rememberTopAppBarState(), + ), + ) }, - qrCodeAnalyzer = qrCodeAnalyzer, - modifier = Modifier.padding(innerPadding), - ) + ) { innerPadding -> + CameraPreview( + cameraErrorReceive = remember(viewModel) { + { viewModel.trySendAction(QrCodeScanAction.CameraSetupErrorReceive) } + }, + qrCodeAnalyzer = qrCodeAnalyzer, + modifier = Modifier.padding(innerPadding), + ) - if (LocalConfiguration.current.isPortrait) { - PortraitQRCodeContent( - onEnterCodeManuallyClick = onEnterCodeManuallyClick, - modifier = Modifier.padding(innerPadding), - ) - } else { - LandscapeQRCodeContent( - onEnterCodeManuallyClick = onEnterCodeManuallyClick, - modifier = Modifier.padding(innerPadding), - ) + if (LocalConfiguration.current.isPortrait) { + PortraitQRCodeContent( + onEnterCodeManuallyClick = onEnterCodeManuallyClick, + modifier = Modifier.padding(innerPadding), + ) + } else { + LandscapeQRCodeContent( + onEnterCodeManuallyClick = onEnterCodeManuallyClick, + modifier = Modifier.padding(innerPadding), + ) + } } } } @@ -162,7 +168,7 @@ private fun PortraitQRCodeContent( modifier = Modifier .weight(1f) .fillMaxSize() - .background(color = Color.Black.copy(alpha = .4f)) + .background(color = BitwardenTheme.colorScheme.background.scrim) .padding(horizontal = 16.dp) .verticalScroll(rememberScrollState()), ) { @@ -202,7 +208,7 @@ private fun LandscapeQRCodeContent( modifier = Modifier .weight(1f) .fillMaxSize() - .background(color = Color.Black.copy(alpha = .4f)) + .background(color = BitwardenTheme.colorScheme.background.scrim) .padding(horizontal = 16.dp) .navigationBarsPadding() .verticalScroll(rememberScrollState()), @@ -311,7 +317,7 @@ private fun QrCodeSquare( modifier: Modifier = Modifier, squareOutlineSize: Dp, ) { - val color = MaterialTheme.colorScheme.primary + val color = BitwardenTheme.colorScheme.text.primary Box( contentAlignment = Alignment.Center, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultFilter.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultFilter.kt index a22b0afe51..7fa69f3aa2 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultFilter.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultFilter.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable @@ -71,7 +70,7 @@ fun VaultFilter( Row( modifier = Modifier .scrolledContainerBackground(topAppBarScrollBehavior) - .bottomDivider(color = MaterialTheme.colorScheme.outlineVariant) + .bottomDivider() .padding(vertical = 8.dp) .testTag("ActiveFilterRow") .then(modifier), @@ -83,7 +82,7 @@ fun VaultFilter( selectedVaultFilterType.name(), ), style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, modifier = Modifier .testTag("ActiveFilterLabel") .weight(1f), @@ -95,7 +94,6 @@ fun VaultFilter( vectorIconRes = R.drawable.ic_more_horizontal, contentDescription = stringResource(id = R.string.filter_by_vault), onClick = { shouldShowSelectionDialog = true }, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.testTag(tag = "OpenOrgFilter"), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultNoItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultNoItems.kt index f9e9e92800..fd00dbac58 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultNoItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultNoItems.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -53,7 +52,7 @@ fun VaultNoItems( Icon( painter = rememberVectorPainter(id = R.drawable.ic_search), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier .size(74.dp) .padding(horizontal = 16.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeItem.kt index 3254543981..5eb3cfa336 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeItem.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -58,7 +57,9 @@ fun VaultVerificationCodeItem( modifier = Modifier .clickable( interactionSource = remember { MutableInteractionSource() }, - indication = ripple(color = MaterialTheme.colorScheme.primary), + indication = ripple( + color = BitwardenTheme.colorScheme.background.pressed, + ), onClick = onItemClick, ) .defaultMinSize(minHeight = 72.dp) @@ -70,7 +71,7 @@ fun VaultVerificationCodeItem( BitwardenIcon( iconData = startIcon, contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface, + tint = BitwardenTheme.colorScheme.icon.primary, modifier = Modifier.size(24.dp), ) @@ -82,7 +83,7 @@ fun VaultVerificationCodeItem( Text( text = label, style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.text.primary, maxLines = 1, overflow = TextOverflow.Ellipsis, ) @@ -91,7 +92,7 @@ fun VaultVerificationCodeItem( Text( text = it, style = BitwardenTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, maxLines = 1, overflow = TextOverflow.Ellipsis, ) @@ -107,14 +108,14 @@ fun VaultVerificationCodeItem( Text( text = authCode.chunked(3).joinToString(" "), style = BitwardenTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = BitwardenTheme.colorScheme.text.primary, ) BitwardenStandardIconButton( vectorIconRes = R.drawable.ic_copy, contentDescription = stringResource(id = R.string.copy), onClick = onCopyClick, - contentColor = MaterialTheme.colorScheme.primary, + contentColor = BitwardenTheme.colorScheme.icon.secondary, ) } } diff --git a/app/src/main/res/values-night/ic_launcher_background.xml b/app/src/main/res/values-night/ic_launcher_background.xml deleted file mode 100644 index 8487c053c3..0000000000 --- a/app/src/main/res/values-night/ic_launcher_background.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - @color/blue_175DDC - @color/white - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index 6259bea046..0000000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - @color/silver_DDDDDD - @color/blue_1452BC - @color/blue_175DDC - @color/white_FFFFFF - @color/blue_DAE2FF - @color/blue_001848 - @color/blue_DAE2FF - @color/blue_B2C5FF - @color/blue_001848 - @color/blue_003FA3 - @color/grey_585E71 - @color/white_FFFFFF - @color/grey_DDE2F9 - @color/blue_151B2C - @color/grey_DDE2F9 - @color/grey_C0C6DD - @color/blue_151B2C - @color/grey_404659 - @color/blue_3B5BA9 - @color/white_FFFFFF - @color/blue_DAE2FF - @color/blue_001848 - @color/blue_DAE2FF - @color/blue_B2C5FF - @color/blue_001848 - @color/blue_1F438F - @color/red_BA1A1A - @color/white_FFFFFF - @color/red_FFDAD6 - @color/red_410002 - @color/grey_DBD9DD - @color/grey_FBF8FD - @color/grey_DDE3EA - @color/grey_FBF8FD - @color/white_FFFFFF - @color/white_F5F3F7 - @color/white_EFEDF1 - @color/white_E9E7EC - @color/white_E4E2E6 - @color/grey_1B1B1F - @color/grey_45464F - @color/grey_757780 - @color/white_C5C6D0 - @color/grey_303034 - @color/grey_F2F0F4 - @color/blue_B2C5FF - @color/black_000000 - @color/black_000000 - - - @color/grey_666666 - @color/grey_191919 - @color/blue_B2C5FF - @color/blue_002B74 - @color/blue_003FA3 - @color/blue_DAE2FF - @color/blue_DAE2FF - @color/blue_B2C5FF - @color/blue_001848 - @color/blue_003FA3 - @color/grey_C0C6DD - @color/grey_2A3042 - @color/grey_404659 - @color/grey_DDE2F9 - @color/grey_DDE2F9 - @color/grey_C0C6DD - @color/blue_151B2C - @color/grey_404659 - @color/blue_B2C5FF - @color/blue_002B73 - @color/blue_1F438F - @color/blue_DAE2FF - @color/blue_DAE2FF - @color/blue_B2C5FF - @color/blue_001848 - @color/blue_1F438F - @color/red_FFB4AB - @color/red_690005 - @color/red_93000A - @color/red_FFDAD6 - @color/grey_131316 - @color/grey_131316 - @color/grey_45464F - @color/grey_39393C - @color/grey_0D0E11 - @color/grey_1B1B1F - @color/grey_1F1F23 - @color/grey_292A2D - @color/grey_343438 - @color/grey_C7C6CA - @color/white_C5C6D0 - @color/grey_8F909A - @color/grey_45464F - @color/white_E4E2E6 - @color/grey_1B1B1F - @color/blue_0055D4 - @color/black_000000 - @color/black_000000 - - - @color/black_000000 - @color/grey_333333 - @color/grey_738182 - @color/grey_EFEFF4 - @color/white_FFFFFF - @color/magenta_C01176 - @color/magenta_F08DC7 - @color/orange_8B6609 - @color/orange_C9914F - @color/green_017E45 - @color/green_41B06D - @color/blue_B2C5FF - diff --git a/app/src/main/res/values/colors_palette.xml b/app/src/main/res/values/colors_palette.xml deleted file mode 100644 index 65e99f9e68..0000000000 --- a/app/src/main/res/values/colors_palette.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - #DAE2FF - #B2C5FF - #175DDC - #0055D4 - #3B5BA9 - #1452BC - #1F438F - #003FA3 - #002B74 - #002B73 - #001848 - #151B2C - - - #FBF8FD - #DDE3EA - #DDE2F9 - #EFEFF4 - #F2F0F4 - #DBD9DD - #E4E2E6 - #C5C6D0 - #C7C6CA - #8F909A - #C0C6DD - #757780 - #738182 - #585E71 - #666666 - #45464F - #404659 - #333333 - #303034 - #2A3042 - #39393C - #292A2D - #343438 - #1F1F23 - #1B1B1F - #191919 - #131316 - #0D0E11 - - - #FFDAD6 - #FFB4AB - #BA1A1A - #93000A - #690005 - #410002 - - - #FFFFFF - #F5F3F7 - #EFEDF1 - #E9E7EC - #C5C6D0 - #E4E2E6 - - - #dddddd - #000000 - #FF8B6609 - #FFC9914F - #FF017E45 - #FF41B06D - #FFF08DC7 - #FFC01176 - - diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml index 8487c053c3..ddfad1d9ec 100644 --- a/app/src/main/res/values/ic_launcher_background.xml +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -1,5 +1,6 @@ - @color/blue_175DDC - @color/white + + #FF175DDC + @android:color/white diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/base/util/ColorExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/base/util/ColorExtensionsTest.kt index 22a0964d43..31a55b9940 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/base/util/ColorExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/base/util/ColorExtensionsTest.kt @@ -1,11 +1,11 @@ package com.x8bit.bitwarden.data.platform.base.util -import androidx.compose.material3.MaterialTheme import androidx.compose.ui.graphics.Color import com.x8bit.bitwarden.ui.platform.base.BaseComposeTest import com.x8bit.bitwarden.ui.platform.base.util.isLightOverlayRequired import com.x8bit.bitwarden.ui.platform.base.util.toSafeOverlayColor import com.x8bit.bitwarden.ui.platform.feature.settings.appearance.model.AppTheme +import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue @@ -28,7 +28,7 @@ class ColorExtensionsTest : BaseComposeTest() { fun `toSafeOverlayColor for a dark color in light mode should use the surface color`() = runTestWithTheme(theme = AppTheme.LIGHT) { assertEquals( - MaterialTheme.colorScheme.surface, + BitwardenTheme.colorScheme.background.primary, Color.Blue.toSafeOverlayColor(), ) } @@ -37,7 +37,7 @@ class ColorExtensionsTest : BaseComposeTest() { fun `toSafeOverlayColor for a dark color in dark mode should use the onSurface color`() = runTestWithTheme(theme = AppTheme.DARK) { assertEquals( - MaterialTheme.colorScheme.onSurface, + BitwardenTheme.colorScheme.text.primary, Color.Blue.toSafeOverlayColor(), ) } @@ -46,7 +46,7 @@ class ColorExtensionsTest : BaseComposeTest() { fun `toSafeOverlayColor for a light color in light mode should use the onSurface color`() = runTestWithTheme(theme = AppTheme.LIGHT) { assertEquals( - MaterialTheme.colorScheme.onSurface, + BitwardenTheme.colorScheme.text.primary, Color.Yellow.toSafeOverlayColor(), ) } @@ -55,7 +55,7 @@ class ColorExtensionsTest : BaseComposeTest() { fun `toSafeOverlayColor for a light color in dark mode should use the surface color`() = runTestWithTheme(theme = AppTheme.DARK) { assertEquals( - MaterialTheme.colorScheme.surface, + BitwardenTheme.colorScheme.background.primary, Color.Yellow.toSafeOverlayColor(), ) } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViewsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViewsTest.kt index 83c59f6aac..2ea88b225a 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViewsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/autofill/BitwardenRemoteViewsTest.kt @@ -22,14 +22,6 @@ import org.junit.jupiter.api.Test class BitwardenRemoteViewsTest { private val testContext: Context = mockk { - every { this@mockk.getColor(R.color.dark_on_surface) } returns DARK_ON_SURFACE_COLOR - every { - this@mockk.getColor(R.color.dark_on_surface_variant) - } returns DARK_ON_SURFACE_VARIANT_COLOR - every { this@mockk.getColor(R.color.dark_surface) } returns DARK_SURFACE_COLOR - every { this@mockk.getColor(R.color.on_surface) } returns ON_SURFACE_COLOR - every { this@mockk.getColor(R.color.on_surface_variant) } returns ON_SURFACE_VARIANT_COLOR - every { this@mockk.getColor(R.color.surface) } returns SURFACE_COLOR every { this@mockk.getString(R.string.app_name) } returns APP_NAME every { this@mockk.getString(R.string.go_to_my_vault) } returns GO_TO_MY_VAULT every { this@mockk.getString(R.string.vault_is_locked) } returns VAULT_IS_LOCKED @@ -108,25 +100,25 @@ class BitwardenRemoteViewsTest { .setInt( R.id.container, "setBackgroundColor", - SURFACE_COLOR, + COLOR_LIGHT_BACKGROUND, ) anyConstructed() .setInt( R.id.icon, "setColorFilter", - ON_SURFACE_COLOR, + COLOR_LIGHT_ICON_TINT, ) anyConstructed() .setInt( R.id.title, "setTextColor", - ON_SURFACE_COLOR, + COLOR_LIGHT_TEXT_PRIMARY, ) anyConstructed() .setInt( R.id.subtitle, "setTextColor", - ON_SURFACE_VARIANT_COLOR, + COLOR_LIGHT_TEXT_SECONDARY, ) } } @@ -181,25 +173,25 @@ class BitwardenRemoteViewsTest { .setInt( R.id.container, "setBackgroundColor", - DARK_SURFACE_COLOR, + COLOR_DARK_BACKGROUND, ) anyConstructed() .setInt( R.id.icon, "setColorFilter", - DARK_ON_SURFACE_COLOR, + COLOR_DARK_ICON_TINT, ) anyConstructed() .setInt( R.id.title, "setTextColor", - DARK_ON_SURFACE_COLOR, + COLOR_DARK_TEXT_PRIMARY, ) anyConstructed() .setInt( R.id.subtitle, "setTextColor", - DARK_ON_SURFACE_VARIANT_COLOR, + COLOR_DARK_TEXT_SECONDARY, ) } } @@ -245,19 +237,19 @@ class BitwardenRemoteViewsTest { .setInt( R.id.container, "setBackgroundColor", - SURFACE_COLOR, + COLOR_LIGHT_BACKGROUND, ) anyConstructed() .setInt( R.id.title, "setTextColor", - ON_SURFACE_COLOR, + COLOR_LIGHT_TEXT_PRIMARY, ) anyConstructed() .setInt( R.id.subtitle, "setTextColor", - ON_SURFACE_VARIANT_COLOR, + COLOR_LIGHT_TEXT_SECONDARY, ) } } @@ -303,19 +295,19 @@ class BitwardenRemoteViewsTest { .setInt( R.id.container, "setBackgroundColor", - DARK_SURFACE_COLOR, + COLOR_DARK_BACKGROUND, ) anyConstructed() .setInt( R.id.title, "setTextColor", - DARK_ON_SURFACE_COLOR, + COLOR_DARK_TEXT_PRIMARY, ) anyConstructed() .setInt( R.id.subtitle, "setTextColor", - DARK_ON_SURFACE_VARIANT_COLOR, + COLOR_DARK_TEXT_SECONDARY, ) } } @@ -351,7 +343,7 @@ class BitwardenRemoteViewsTest { .setInt( R.id.container, "setBackgroundColor", - DARK_SURFACE_COLOR, + COLOR_LIGHT_BACKGROUND, ) } just runs every { @@ -359,7 +351,7 @@ class BitwardenRemoteViewsTest { .setInt( R.id.icon, "setColorFilter", - DARK_ON_SURFACE_COLOR, + COLOR_LIGHT_ICON_TINT, ) } just runs every { @@ -367,7 +359,7 @@ class BitwardenRemoteViewsTest { .setInt( R.id.icon, "setColorFilter", - ON_SURFACE_COLOR, + COLOR_LIGHT_ICON_TINT, ) } just runs every { @@ -375,7 +367,7 @@ class BitwardenRemoteViewsTest { .setInt( R.id.title, "setTextColor", - DARK_ON_SURFACE_COLOR, + COLOR_LIGHT_TEXT_PRIMARY, ) } just runs every { @@ -383,22 +375,24 @@ class BitwardenRemoteViewsTest { .setInt( R.id.subtitle, "setTextColor", - DARK_ON_SURFACE_VARIANT_COLOR, + COLOR_LIGHT_TEXT_SECONDARY, ) } just runs } } private const val APP_NAME = "Bitwarden" -private const val DARK_ON_SURFACE_COLOR: Int = 321 -private const val DARK_ON_SURFACE_VARIANT_COLOR: Int = 654 -private const val DARK_SURFACE_COLOR: Int = 987 +private const val COLOR_DARK_BACKGROUND: Int = -15590873 +private const val COLOR_DARK_ICON_TINT: Int = -6904901 +private const val COLOR_DARK_TEXT_PRIMARY: Int = -788743 +private const val COLOR_DARK_TEXT_SECONDARY: Int = -7825227 +private const val COLOR_LIGHT_BACKGROUND: Int = -788743 +private const val COLOR_LIGHT_ICON_TINT: Int = -10850927 +private const val COLOR_LIGHT_TEXT_PRIMARY: Int = -14999511 +private const val COLOR_LIGHT_TEXT_SECONDARY: Int = -10850927 private const val GO_TO_MY_VAULT = "Go to my vault" private const val ICON_RES: Int = 41421421 private const val NAME: String = "NAME" -private const val ON_SURFACE_COLOR: Int = 123 -private const val ON_SURFACE_VARIANT_COLOR: Int = 456 private const val PACKAGE_NAME: String = "com.x8bit.bitwarden" private const val SUBTITLE: String = "SUBTITLE" -private const val SURFACE_COLOR: Int = 789 private const val VAULT_IS_LOCKED = "Vault is locked" diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensionsTest.kt index 910dc17f44..465c96b365 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/autofill/util/InlinePresentationSpecExtensionsTest.kt @@ -126,12 +126,11 @@ class InlinePresentationSpecExtensionsTest { PENDING_INTENT_FLAGS, ) testContext.isSystemDarkMode - testContext.getColor(R.color.dark_on_surface) Icon.createWithResource( testContext, iconRes, ) - .setTint(ICON_TINT) + .setTint(COLOR_DARK_ICON_TINT) InlineSuggestionUi.newContentBuilder(pendingIntent) .setTitle(AUTOFILL_CIPHER_NAME) .setSubtitle(AUTOFILL_CIPHER_SUBTITLE) @@ -186,12 +185,12 @@ class InlinePresentationSpecExtensionsTest { PENDING_INTENT_FLAGS, ) testContext.isSystemDarkMode - testContext.getColor(R.color.on_surface) - Icon.createWithResource( - testContext, - iconRes, - ) - .setTint(ICON_TINT) + Icon + .createWithResource( + testContext, + iconRes, + ) + .setTint(COLOR_LIGHT_ICON_TINT) InlineSuggestionUi.newContentBuilder(pendingIntent) .setTitle(AUTOFILL_CIPHER_NAME) .setSubtitle(AUTOFILL_CIPHER_SUBTITLE) @@ -334,14 +333,21 @@ class InlinePresentationSpecExtensionsTest { ) } returns pendingIntent every { testContext.isSystemDarkMode } returns isSystemDarkMode - every { testContext.getColor(R.color.on_surface) } returns ICON_TINT - every { testContext.getColor(R.color.dark_on_surface) } returns ICON_TINT every { - Icon.createWithResource( - testContext, - iconRes, - ) - .setTint(ICON_TINT) + Icon + .createWithResource( + testContext, + iconRes, + ) + .setTint(COLOR_DARK_ICON_TINT) + } returns icon + every { + Icon + .createWithResource( + testContext, + iconRes, + ) + .setTint(COLOR_LIGHT_ICON_TINT) } returns icon every { InlineSuggestionUi @@ -416,7 +422,8 @@ private const val LOGIN = "Login" private const val APP_NAME = "Bitwarden" private const val AUTOFILL_CIPHER_NAME = "Cipher1" private const val AUTOFILL_CIPHER_SUBTITLE = "Subtitle" -private const val ICON_TINT: Int = 6123751 +private const val COLOR_DARK_ICON_TINT: Int = -6904901 +private const val COLOR_LIGHT_ICON_TINT: Int = -10850927 private const val MY_VAULT = "My vault" private const val PENDING_INTENT_CODE: Int = 0 private const val PENDING_INTENT_FLAGS: Int = diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7c18839165..8a7cb469f3 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -8,12 +8,12 @@ - [Note on Dependency Injection](#note-on-dependency-injection) - [UI Layer](#ui-layer) - [ViewModels / MVVM](#viewmodels--mvvm) - - [Example](#example) + - [Example](#example) - [Screens / Compose](#screens--compose) - [State Hoisting](#state-hoisting) - [Example](#example-1) - [Navigation](#navigation) - - [State-based Navigation](#state-based-navigation) + - [State-based Navigation](#state-based-navigation) - [Event-based Navigation](#event-based-navigation) - [Navigation Implementation](#navigation-implementation) - [Example](#example-2) @@ -34,7 +34,7 @@ The responsibilities of the data layer are to manage the storage and retrieval o ## Data Layer -The data layer is where all the UI-independent data is stored and retrieved. It consists of both raw data sources as well as higher-level "repository" and "manager" classes. +The data layer is where all the UI-independent data is stored and retrieved. It consists of both raw data sources as well as higher-level "repository" and "manager" classes. Note that any functions exposed by a data layer class that must perform asynchronous work do so by exposing **suspending functions** that may run inside [coroutines](https://kotlinlang.org/docs/coroutines-guide.html) while any streaming sources of data are handled by exposing [Flows](https://kotlinlang.org/docs/flow.html). @@ -79,7 +79,7 @@ The app's approach to MVVM is based around the handling of "state", "actions", a There should be no additional `StateFlow` exposed from a VM that would represent some other kind of state; all state should be represented by `S`. Additionally, any internal state not directly needed by the UI but which influences the behavior of the VM should be included as well in order to keep all state managed by the VM in a single place. - **Actions:** The "actions" represent interactions with the VM in some way that could potentially cause an update to that total state. These can be external actions coming from the user's interaction with the UI, like click events, or internal actions coming from some asynchronous process internal to the VM itself, like the result of some suspending functions. Actions are sent by interacting directly with `BaseViewModel.actionChannel` or by using the `BaseViewModel.sendAction` and `BaseViewModel.trySendAction` helpers. All actions are then processed synchronously in a queue in the `handleAction` function. - + It is worth emphasizing that state should never be updated inside a coroutine in a VM; all asynchronous work that results in a state update should do so by posting an internal action. This ensures that the only place that state changes can occur is synchronously inside the `handleAction` function. This makes the process of finding and reasoning about state changes easier and simplifies debugging. - **Events:** The "events" represent discrete, one-shot side-effects and are typically associated with navigation events triggered by some user action. They are sent internally using `BaseViewModel.sendEvent` and may be consumed by the UI layer via the `BaseViewModel.eventFlow` property. An [EventsEffect](../app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/EventsEffect.kt) should typically be used to simplify the consumption of these events. @@ -323,7 +323,7 @@ fun ExampleScreen( text = state.exampleData, textAlign = TextAlign.Center, style = BitwardenTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface, + color = BitwardenTheme.colorScheme.textColors.primary, modifier = Modifier .padding(horizontal = 24.dp) .wrapContentHeight(),