Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 016826ea authored by Michał Brzeziński's avatar Michał Brzeziński Committed by Android (Google) Code Review
Browse files

Merge "Fix body text color in mono theme" into main

parents 2fd52a68 e69c29fb
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ import androidx.compose.runtime.saveable.mapSaver
import androidx.compose.ui.Modifier
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.stringResource
@@ -216,7 +215,7 @@ fun TutorialDescription(
        Text(
        Text(
            text = stringResource(id = bodyTextId),
            text = stringResource(id = bodyTextId),
            style = MaterialTheme.typography.bodyLarge,
            style = MaterialTheme.typography.bodyLarge,
            color = Color.White,
            color = config.colors.bodyText,
        )
        )
    }
    }
}
}
+19 −1
Original line number Original line Diff line number Diff line
@@ -16,9 +16,12 @@


package com.android.systemui.inputdevice.tutorial.ui.composable
package com.android.systemui.inputdevice.tutorial.ui.composable


import androidx.annotation.ColorInt
import androidx.annotation.RawRes
import androidx.annotation.RawRes
import androidx.annotation.StringRes
import androidx.annotation.StringRes
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.core.graphics.ColorUtils
import com.airbnb.lottie.compose.LottieDynamicProperties
import com.airbnb.lottie.compose.LottieDynamicProperties


data class TutorialScreenConfig(
data class TutorialScreenConfig(
@@ -30,8 +33,23 @@ data class TutorialScreenConfig(
    data class Colors(
    data class Colors(
        val background: Color,
        val background: Color,
        val title: Color,
        val title: Color,
        val bodyText: Color,
        val animationColors: LottieDynamicProperties,
        val animationColors: LottieDynamicProperties,
    )
    ) {
        constructor(
            background: Color,
            title: Color,
            animationColors: LottieDynamicProperties,
        ) : this(background, title, textColorOnBackground(background.toArgb()), animationColors)

        companion object {
            private fun textColorOnBackground(@ColorInt background: Int): Color {
                val whiteContrast = ColorUtils.calculateContrast(Color.White.toArgb(), background)
                val blackContrast = ColorUtils.calculateContrast(Color.Black.toArgb(), background)
                return if (whiteContrast >= blackContrast) Color.White else Color.Black
            }
        }
    }


    data class Strings(
    data class Strings(
        @StringRes val titleResId: Int,
        @StringRes val titleResId: Int,