Anyone have any ideas why my icon is always black ...
# compose
c
Anyone have any ideas why my icon is always black and not Red?
Copy code
val collapsedPathData = "M 12 13.17 L 7.41 8.59 L 6 10 L 12 16 L 18 10 L 16.59 8.59 L 12 13.17"
    val collapsedPathNodes = remember { addPathNodes(collapsedPathData) }
    Icon(
        contentDescription = "",
        painter = rememberVectorPainter(24.dp, 24.dp, 24f, 24f,) { _, _ ->
            Path(pathData = collapsedPathNodes, fill = SolidColor(Color.Red),) }
    )
s
use tint parameter to pass your tint color
c
Hm. Tint param on the Icon right? I tried that too and it didn't work. Maybe because my path was red and tint was red?
@Samir Basnet still didn't work.
Copy code
Icon(
        contentDescription = "",
        tint = Color.Red,
        painter = rememberVectorPainter(24.dp, 24.dp, 24f, 24f,) { _, _ ->
            Path(pathData = collapsedPathNodes) }
    )
Hm. I added the solidColor declaration again and with tint it worked. Thanks
👍 1