'Change background color of Badge compose

The default color of the Badge is red , how to change this color in jetpack compose? I am using Badge inside BagedBox and I have already tried Modifier.Background... but it is not working.



Solution 1:[1]

Starting with compose 1.1.x you can use the backgroundColor attribute in the Badge composable

BadgedBox(
    badge = {
        Badge(backgroundColor=Green) { Text("8") } 
    }
){
   //...
}

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1