Thread
#compose
    Ian Warwick

    Ian Warwick

    2 years ago
    Not sure what I am doing wrong here but newing up a
    Color
    for Green shows up as Red in
    @Preview
    and in emulator? apologies if this is a known issue
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    2 years ago
    What is the code in the
    @Preview
    function? Preview does not use the Activity's
    onCreate
    .
    Ian Warwick

    Ian Warwick

    2 years ago
    Sorry it happens in both preview and in app the code is equivalent, one sec
    @Composable
    @Preview
    fun WrongColor() {
        val color = Color(0f, 255f, 0f)
    
        Surface(color = color) {
            Container(width = 100.dp, height = 100.dp) {
                Text("Hello")
            }
        }
    }
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    2 years ago
    Definitely worth a bug report.
    Ian Warwick

    Ian Warwick

    2 years ago
    cool will do
    matvei

    matvei

    2 years ago
    Haha, I tool a look. It turns out we have Float and Int overloads for Color constructor. Try removing
    f
    s from color components or substitute 255f with 1f, this might help
    Anyway, thanks very much for filing this, we will take a look into this ambiguity