Gradient background
donatkajtazi opened this issue · 4 comments
donatkajtazi commented
Is there a way that we can make a gradient background that fills the whole qr
alexzhirkevich commented
Is there a way that we can make a gradient background that fills the whole qr
For Bitmap QR code you can just set background color to gradient in options:
val options = createQrOptions(1024) {
background {
color = QrColor.LinearGradient(
android.graphics.Color.RED, android.graphics.Color.BLUE,
QrColor.LinearGradient.Orientation.LeftDiagonal
)
}
}
For Drawable QR code you can do it like that:
val gradientDrawable = GradientDrawable(
GradientDrawable.Orientation.TL_BR,
intArrayOf(android.graphics.Color.RED, android.graphics.Color.BLUE)
)
val codeDrawable = QrCodeDrawable(context, data, anyOptions)
val codeWithGradientBg = LayerDrawable(arrayOf(gradientDrawable, codeDrawable))
alexzhirkevich commented
Is that what you need, @donatkajtazi?
donatkajtazi commented
Is that what you need, @donatkajtazi?
looks like it was there all along I just didn't find it
alexzhirkevich commented
Background image and color for Drawable codes (without LayerDrawable) will be supported in the next update (1.5.3)