Skip to content

Commit 8e496aa

Browse files
committed
Remove all direct usages of mullvad colors
1 parent 6e2b93d commit 8e496aa

File tree

10 files changed

+48
-65
lines changed

10 files changed

+48
-65
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CheckboxCell.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview
2222
import androidx.compose.ui.unit.Dp
2323
import net.mullvad.mullvadvpn.lib.theme.AppTheme
2424
import net.mullvad.mullvadvpn.lib.theme.Dimens
25-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadGreen
25+
import net.mullvad.mullvadvpn.lib.theme.color.selected
2626

2727
@Preview
2828
@Composable
@@ -64,7 +64,7 @@ internal fun CheckboxCell(
6464
CheckboxDefaults.colors(
6565
checkedColor = Color.Transparent,
6666
uncheckedColor = Color.Transparent,
67-
checkmarkColor = MullvadGreen
67+
checkmarkColor = MaterialTheme.colorScheme.selected
6868
),
6969
)
7070
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt

+11-10
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,29 @@ import androidx.compose.ui.graphics.Color
1515
import androidx.compose.ui.res.painterResource
1616
import androidx.compose.ui.tooling.preview.Preview
1717
import net.mullvad.mullvadvpn.R
18+
import net.mullvad.mullvadvpn.lib.theme.AppTheme
1819
import net.mullvad.mullvadvpn.lib.theme.Dimens
1920
import net.mullvad.mullvadvpn.lib.theme.color.AlphaInactive
2021
import net.mullvad.mullvadvpn.lib.theme.color.AlphaVisible
21-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadBlue
22-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadWhite
2322

2423
@Preview
2524
@Composable
2625
private fun PreviewInformationComposeCell() {
27-
InformationComposeCell(
28-
title = "Information row title",
29-
isEnabled = true,
30-
onCellClicked = {},
31-
onInfoClicked = {}
32-
)
26+
AppTheme {
27+
InformationComposeCell(
28+
title = "Information row title",
29+
isEnabled = true,
30+
onCellClicked = {},
31+
onInfoClicked = {}
32+
)
33+
}
3334
}
3435

3536
@Composable
3637
fun InformationComposeCell(
3738
title: String,
3839
isEnabled: Boolean = true,
39-
background: Color = MullvadBlue,
40+
background: Color = MaterialTheme.colorScheme.primary,
4041
onCellClicked: () -> Unit = {},
4142
onInfoClicked: (() -> Unit)? = null
4243
) {
@@ -75,7 +76,7 @@ private fun InformationComposeCellBody(modifier: Modifier, onInfoClicked: (() ->
7576
Icon(
7677
painter = painterResource(id = R.drawable.icon_info),
7778
contentDescription = null,
78-
tint = MullvadWhite
79+
tint = MaterialTheme.colorScheme.onPrimary
7980
)
8081
}
8182
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import androidx.compose.ui.tooling.preview.Preview
2020
import net.mullvad.mullvadvpn.R
2121
import net.mullvad.mullvadvpn.lib.theme.AppTheme
2222
import net.mullvad.mullvadvpn.lib.theme.Dimens
23-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadBlue
2423
import net.mullvad.mullvadvpn.lib.theme.shape.chipShape
2524

2625
@Preview
@@ -40,7 +39,8 @@ fun MullvadFilterChip(text: String, onRemoveClick: () -> Unit) {
4039
FilterChip(
4140
modifier = Modifier.padding(vertical = Dimens.chipVerticalPadding),
4241
shape = MaterialTheme.shapes.chipShape,
43-
colors = FilterChipDefaults.filterChipColors(containerColor = MullvadBlue),
42+
colors =
43+
FilterChipDefaults.filterChipColors(containerColor = MaterialTheme.colorScheme.primary),
4444
border =
4545
FilterChipDefaults.filterChipBorder(
4646
borderColor = Color.Transparent,

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import net.mullvad.mullvadvpn.compose.button.PrimaryButton
2424
import net.mullvad.mullvadvpn.compose.textfield.DnsTextField
2525
import net.mullvad.mullvadvpn.lib.theme.AppTheme
2626
import net.mullvad.mullvadvpn.lib.theme.Dimens
27-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadRed
2827
import net.mullvad.mullvadvpn.viewmodel.DnsDialogSideEffect
2928
import net.mullvad.mullvadvpn.viewmodel.DnsDialogViewModel
3029
import net.mullvad.mullvadvpn.viewmodel.DnsDialogViewState
@@ -169,7 +168,7 @@ fun DnsDialog(
169168
Text(
170169
text = errorMessage,
171170
style = MaterialTheme.typography.bodySmall,
172-
color = MullvadRed,
171+
color = MaterialTheme.colorScheme.error,
173172
modifier = Modifier.padding(top = Dimens.smallPadding)
174173
)
175174
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ fun SelectLocationScreen(
161161
modifier =
162162
Modifier.fillMaxWidth()
163163
.height(Dimens.searchFieldHeight)
164-
.padding(horizontal = Dimens.searchFieldHorizontalPadding)
164+
.padding(horizontal = Dimens.searchFieldHorizontalPadding),
165+
backgroundColor = MaterialTheme.colorScheme.tertiaryContainer,
166+
textColor = MaterialTheme.colorScheme.onTertiaryContainer
165167
) { searchString ->
166168
onSearchTermInput.invoke(searchString)
167169
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme
6060
import net.mullvad.mullvadvpn.lib.theme.Dimens
6161
import net.mullvad.mullvadvpn.lib.theme.color.AlphaScrollbar
6262
import net.mullvad.mullvadvpn.lib.theme.color.AlphaTopBar
63-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadWhite
6463
import net.mullvad.mullvadvpn.viewmodel.WelcomeViewModel
6564
import org.koin.androidx.compose.koinViewModel
6665

@@ -335,7 +334,7 @@ fun DeviceNameRow(deviceName: String?, navigateToDeviceInfoDialog: () -> Unit) {
335334
Icon(
336335
painter = painterResource(id = R.drawable.icon_info),
337336
contentDescription = null,
338-
tint = MullvadWhite
337+
tint = MaterialTheme.colorScheme.onPrimary
339338
)
340339
}
341340
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/SearchTextField.kt

+15-13
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ import androidx.compose.ui.tooling.preview.Preview
2929
import net.mullvad.mullvadvpn.R
3030
import net.mullvad.mullvadvpn.lib.theme.AppTheme
3131
import net.mullvad.mullvadvpn.lib.theme.Dimens
32-
import net.mullvad.mullvadvpn.lib.theme.color.MullvadWhite10
3332

3433
@Preview
3534
@Composable
3635
private fun PreviewSearchTextField() {
3736
AppTheme {
3837
Column(modifier = Modifier.background(color = MaterialTheme.colorScheme.background)) {
39-
SearchTextField(placeHolder = "Search for...") {}
38+
SearchTextField(
39+
placeHolder = "Search for...",
40+
backgroundColor = MaterialTheme.colorScheme.tertiaryContainer,
41+
textColor = MaterialTheme.colorScheme.onTertiaryContainer,
42+
) {}
4043
}
4144
}
4245
}
@@ -46,7 +49,8 @@ private fun PreviewSearchTextField() {
4649
fun SearchTextField(
4750
modifier: Modifier = Modifier,
4851
placeHolder: String = stringResource(id = R.string.search_placeholder),
49-
backgroundColor: Color = MullvadWhite10,
52+
backgroundColor: Color,
53+
textColor: Color,
5054
enabled: Boolean = true,
5155
singleLine: Boolean = true,
5256
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
@@ -57,14 +61,13 @@ fun SearchTextField(
5761

5862
BasicTextField(
5963
value = searchTerm,
60-
textStyle =
61-
MaterialTheme.typography.labelLarge.copy(color = MaterialTheme.colorScheme.onSecondary),
64+
textStyle = MaterialTheme.typography.labelLarge.copy(color = textColor),
6265
onValueChange = { text: String ->
6366
searchTerm = text
6467
onValueChange.invoke(text)
6568
},
6669
singleLine = singleLine,
67-
cursorBrush = SolidColor(MaterialTheme.colorScheme.onSecondary),
70+
cursorBrush = SolidColor(textColor),
6871
decorationBox =
6972
@Composable { innerTextField ->
7073
TextFieldDefaults.DecorationBox(
@@ -83,8 +86,7 @@ fun SearchTextField(
8386
width = Dimens.searchIconSize,
8487
height = Dimens.searchIconSize,
8588
),
86-
colorFilter =
87-
ColorFilter.tint(color = MaterialTheme.colorScheme.onSecondary),
89+
colorFilter = ColorFilter.tint(color = textColor),
8890
)
8991
},
9092
placeholder = {
@@ -106,15 +108,15 @@ fun SearchTextField(
106108
shape = MaterialTheme.shapes.medium,
107109
colors =
108110
TextFieldDefaults.colors(
109-
focusedTextColor = MaterialTheme.colorScheme.onSecondary,
110-
unfocusedTextColor = MaterialTheme.colorScheme.onSecondary,
111+
focusedTextColor = textColor,
112+
unfocusedTextColor = textColor,
111113
focusedContainerColor = backgroundColor,
112114
unfocusedContainerColor = backgroundColor,
113115
focusedIndicatorColor = Color.Transparent,
114116
unfocusedIndicatorColor = Color.Transparent,
115-
cursorColor = MaterialTheme.colorScheme.onSecondary,
116-
focusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
117-
unfocusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary
117+
cursorColor = textColor,
118+
focusedPlaceholderColor = textColor,
119+
unfocusedPlaceholderColor = textColor
118120
),
119121
contentPadding = PaddingValues(),
120122
)

android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_error
2525
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_onError
2626
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_onPrimary
2727
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_onSurfaceVariant
28+
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_onTertiaryContainer
2829
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_primary
2930
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_secondaryContainer
3031
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_surfaceVariant
32+
import net.mullvad.mullvadvpn.lib.theme.color.md_theme_dark_tertiaryContainer
3133
import net.mullvad.mullvadvpn.lib.theme.dimensions.Dimensions
3234
import net.mullvad.mullvadvpn.lib.theme.dimensions.defaultDimensions
3335
import net.mullvad.mullvadvpn.lib.theme.typeface.TypeScale
@@ -63,8 +65,8 @@ private val darkColorScheme =
6365
secondaryContainer = md_theme_dark_secondaryContainer,
6466
tertiary = MullvadRed,
6567
// onTertiary = md_theme_dark_onTertiary,
66-
// tertiaryContainer = md_theme_dark_tertiaryContainer,
67-
// onTertiaryContainer = md_theme_dark_onTertiaryContainer,
68+
tertiaryContainer = md_theme_dark_tertiaryContainer,
69+
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
6870
error = md_theme_dark_error,
6971
errorContainer = MullvadYellow,
7072
onError = md_theme_dark_onError,

android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/color/Color.kt

+5-29
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,11 @@ import androidx.compose.runtime.Composable
66
import androidx.compose.ui.graphics.Color
77

88
internal val MullvadYellow = Color(0xFFFFD524)
9-
10-
@Deprecated(
11-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
12-
)
13-
val MullvadBlue = Color(0xFF294D73)
14-
@Deprecated(
15-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
16-
)
17-
val MullvadDarkBlue = Color(0xFF192E45)
18-
@Deprecated(
19-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
20-
)
21-
val MullvadGreen = Color(0xFF44AD4D)
22-
@Deprecated(
23-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
24-
)
25-
val MullvadRed = Color(0xFFE34039)
26-
@Deprecated(
27-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
28-
)
29-
val MullvadWhite = Color(0xFFFFFFFF)
30-
@Deprecated(
31-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
32-
)
33-
val MullvadWhite10 = Color(0x1AFFFFFF)
34-
@Deprecated(
35-
"Deprecated for external usage and will be marked as internal in the future. Use material colors instead."
36-
)
37-
val MullvadWhite60 = Color(0x99FFFFFF)
9+
internal val MullvadGreen = Color(0xFF44AD4D)
10+
internal val MullvadWhite60 = Color(0x99FFFFFF)
11+
internal val MullvadWhite = Color(0xFFFFFFFF)
12+
internal val MullvadRed = Color(0xFFE34039)
13+
internal val MullvadDarkBlue = Color(0xFF192E45)
3814

3915
const val AlphaVisible = 1f
4016
const val AlphaDisabled = 0.2f

android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/color/ColorTokens.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ internal val md_theme_dark_secondaryContainer =
4343
internal val md_theme_dark_onSecondaryContainer = Color(0xFFD9EEDB) // Text in titlebar
4444
internal val md_theme_dark_tertiary = Color(0xFF99454F) // Disconnect button
4545
internal val md_theme_dark_onTertiary = Color(0xFFFFFFFF) // MullvadWhite/Text on disconnect button
46-
internal val md_theme_dark_tertiaryContainer = Color(0xFF643F00) // Generated
47-
internal val md_theme_dark_onTertiaryContainer = Color(0xFFFFFFFF) // MullvadWhite
46+
internal val md_theme_dark_tertiaryContainer =
47+
Color(0xff304358) // MullvadWhite Alpha 10 composite over MullvadDarkBlue
48+
internal val md_theme_dark_onTertiaryContainer =
49+
Color(0xffacb4bc) // MullvadWhite Alpha 60 composite over tertiary container
4850
internal val md_theme_dark_error = Color(0xFFE34039) // MullvadRed
4951
internal val md_theme_dark_errorContainer = Color(0xFFE34039) // MullvadRed //Duplicate
5052
internal val md_theme_dark_onError = Color(0xFFFFFFFF) // MullvadWhite

0 commit comments

Comments
 (0)