refactor: rename settings prefs colors too

This commit is contained in:
FunkyMuse 2023-09-29 00:03:49 +02:00
parent 3bd8408a6f
commit 17ce004967
3 changed files with 10 additions and 10 deletions

View file

@ -18,8 +18,8 @@ import com.simplemobiletools.commons.compose.extensions.MyDevices
import com.simplemobiletools.commons.compose.extensions.NoRippleTheme
import com.simplemobiletools.commons.compose.extensions.rememberMutableInteractionSource
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.compose.theme.preferenceSummaryColor
import com.simplemobiletools.commons.compose.theme.preferenceTitleColor
import com.simplemobiletools.commons.compose.theme.preferenceLabelColor
import com.simplemobiletools.commons.compose.theme.preferenceValueColor
@Composable
fun SettingsCheckBoxComponent(
@ -57,7 +57,7 @@ fun SettingsCheckBoxComponent(
.fillMaxWidth()
.padding(end = 16.dp),
text = title,
color = preferenceTitleColor(isEnabled = isPreferenceEnabled),
color = preferenceLabelColor(isEnabled = isPreferenceEnabled),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen.normal_text_size).toSp()
}
@ -68,7 +68,7 @@ fun SettingsCheckBoxComponent(
modifier = Modifier
.fillMaxWidth()
.padding(end = 16.dp),
color = preferenceSummaryColor(isEnabled = isPreferenceEnabled),
color = preferenceValueColor(isEnabled = isPreferenceEnabled),
)
}
}

View file

@ -17,8 +17,8 @@ import androidx.compose.ui.unit.dp
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.compose.extensions.MyDevices
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.compose.theme.preferenceSummaryColor
import com.simplemobiletools.commons.compose.theme.preferenceTitleColor
import com.simplemobiletools.commons.compose.theme.preferenceLabelColor
import com.simplemobiletools.commons.compose.theme.preferenceValueColor
@Composable
fun SettingsPreferenceComponent(
@ -28,8 +28,8 @@ fun SettingsPreferenceComponent(
isPreferenceEnabled: Boolean = true,
doOnPreferenceLongClick: (() -> Unit)? = null,
doOnPreferenceClick: (() -> Unit)? = null,
preferenceSummaryColor: Color = preferenceSummaryColor(isEnabled = isPreferenceEnabled),
preferenceTitleColor: Color = preferenceTitleColor(isEnabled = isPreferenceEnabled)
preferenceSummaryColor: Color = preferenceValueColor(isEnabled = isPreferenceEnabled),
preferenceTitleColor: Color = preferenceLabelColor(isEnabled = isPreferenceEnabled)
) {
Column(
modifier = Modifier

View file

@ -30,12 +30,12 @@ val iconsColor
@Composable
@ReadOnlyComposable
fun preferenceSummaryColor(isEnabled: Boolean) =
fun preferenceValueColor(isEnabled: Boolean) =
if (isEnabled) textSubTitleColor else disabledTextColor
@Composable
@ReadOnlyComposable
fun preferenceTitleColor(isEnabled: Boolean) = if (isEnabled) MaterialTheme.colorScheme.onSurface else disabledTextColor
fun preferenceLabelColor(isEnabled: Boolean) = if (isEnabled) MaterialTheme.colorScheme.onSurface else disabledTextColor
fun Color.isLitWell(threshold: Float = LUMINANCE_THRESHOLD) = luminance() > threshold