diff --git a/Packages/com.walletconnect.core/Runtime/Utils/QRCode.cs b/Packages/com.walletconnect.core/Runtime/Utils/QRCode.cs index 2eeb08b..0e126c3 100644 --- a/Packages/com.walletconnect.core/Runtime/Utils/QRCode.cs +++ b/Packages/com.walletconnect.core/Runtime/Utils/QRCode.cs @@ -8,7 +8,12 @@ public class QRCode { public static Texture2D EncodeTexture(string textForEncoding, int width = 512, int height = 512) { - var pixels = EncodePixels(textForEncoding, width, height); + return EncodeTexture(textForEncoding, Color.black, Color.white, width, height); + } + + public static Texture2D EncodeTexture(string textForEncoding, Color fgColor, Color bgColor, int width = 512, int height = 512) + { + var pixels = EncodePixels(textForEncoding, fgColor, bgColor, width, height); var texture = new Texture2D(width, height); texture.SetPixels32(pixels); @@ -20,6 +25,11 @@ public static Texture2D EncodeTexture(string textForEncoding, int width = 512, i } public static Color32[] EncodePixels(string textForEncoding, int width = 512, int height = 512) + { + return EncodePixels(textForEncoding, Color.black, Color.white, width, height); + } + + public static Color32[] EncodePixels(string textForEncoding, Color fgColor, Color bgColor, int width = 512, int height = 512) { var qrCodeEncodingOptions = new QrCodeEncodingOptions { @@ -32,7 +42,12 @@ public static Color32[] EncodePixels(string textForEncoding, int width = 512, in var writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, - Options = qrCodeEncodingOptions + Options = qrCodeEncodingOptions, + Renderer = new Color32Renderer + { + Foreground = fgColor, + Background = bgColor + } }; return writer.Write(textForEncoding); diff --git a/Packages/com.walletconnect.core/package.json b/Packages/com.walletconnect.core/package.json index 5b74252..98a174f 100644 --- a/Packages/com.walletconnect.core/package.json +++ b/Packages/com.walletconnect.core/package.json @@ -1,6 +1,6 @@ { "name": "com.walletconnect.core", - "version": "3.1.8", + "version": "3.1.9", "displayName": "WalletConnectUnity Core", "unity": "2021.3", "changelogUrl": "https://github.com/WalletConnect/WalletConnectUnity/blob/main/Packages/com.walletconnect.core/CHANGELOG.md",