Skip to content

Instantly share code, notes, and snippets.

@Skrilltrax
Created October 31, 2020 08:24
Show Gist options
  • Save Skrilltrax/fb8c2cdb5cf540367e5922beaa0860e7 to your computer and use it in GitHub Desktop.
Save Skrilltrax/fb8c2cdb5cf540367e5922beaa0860e7 to your computer and use it in GitHub Desktop.
A modifier that add colorful border around your composables
import androidx.compose.foundation.border
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
fun Modifier.colorfulBorders(width: Dp = 1.dp) = composed {
val red = (0..255).random()
val green = (0..255).random()
val blue = (0..255).random()
val color = Color(red, green, blue)
this.border(width, color)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment