alexzhirkevich/custom-qr-generator

Need option to make all eyes different colours

Closed this issue · 3 comments

Is it possible to give different colours to eyes? right now colour applying to all eyes.

Not possible at the moment and is not likely to be. Too colourful QR codes are hardly recognisable for scanners. Avoid doing it

Will be possible after #35 with this code:

class DifferentColor() : QrVectorColor {
    
    override val mode: QrPaintMode = QrPaintMode.Separate

    override fun Paint.paint(width: Float, height: Float, neighbors : Neighbors) {
        when {
            neighbors.bottom &  neighbors.right -> // top left eye
            neighbors.bottomLeft -> top right eye
            neighbors.topRight -> // bottom left eye
            neighbors.topLeft -> // bottom right eye
        }
    }
}

Available in 2.0.0-alpha01 with the code above