samdjstevens / java-totp

A java library for implementing Time-based One Time Passwords for Multi-Factor Authentication.
MIT License
422 stars 103 forks source link

Feature Request: Configurable QR Code color #41

Open timbru31 opened 3 years ago

timbru31 commented 3 years ago

It would be a great addition to allow users to create a different colored QR codes - this is especially useful if you plan to show the code in dark mode for instance and want to invert the colors.

From looking at the code, it seems the used MatrixToImageWriter supports passing in a custom MatrixToImageConfig object, which defines the ON and OFF colors used to create the image. See https://zxing.github.io/zxing/apidocs/com/google/zxing/client/j2se/MatrixToImageWriter.html#writeToStream-com.google.zxing.common.BitMatrix-java.lang.String-java.io.OutputStream-com.google.zxing.client.j2se.MatrixToImageConfig- and https://zxing.github.io/zxing/apidocs/com/google/zxing/client/j2se/MatrixToImageConfig.html

timbru31 commented 3 years ago

(Yes I know I could just create a custom ZxingPngQrGenerator like class to change things)