Code Monkey home page Code Monkey logo

Comments (4)

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

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))

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

Is that what you need, @donatkajtazi?

from custom-qr-generator.

donatkajtazi avatar donatkajtazi commented on July 19, 2024

Is that what you need, @donatkajtazi?

looks like it was there all along I just didn't find it

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

Background image and color for Drawable codes (without LayerDrawable) will be supported in the next update (1.5.3)

from custom-qr-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.