Skip to content

Commit afceb1c

Browse files
committed
autoColor bug fixed.
autoColor bug fixed.
1 parent 287c727 commit afceb1c

File tree

4 files changed

+179
-159
lines changed

4 files changed

+179
-159
lines changed

index.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* NodeJS QRCode generator. Can save image or svg to file, get standard base64 image data url text or get SVG serialized text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.(Running without DOM on server side)
55
*
6-
* Version 4.2.1
6+
* Version 4.2.3
77
*
88
* @author [ inthinkcolor@gmail.com ]
99
*
@@ -1218,12 +1218,23 @@ Drawing.prototype.draw = function(oQRCode) {
12181218

12191219
lColor = "rgba(0,0,0,0)";
12201220
if (row == 6) {
1221-
dColor = _htOption.timing_H || _htOption.timing || _htOption.colorDark;
1221+
// dColor = _htOption.timing_H || _htOption.timing || _htOption.colorDark;
1222+
if (_htOption.autoColor) {
1223+
dColor = _htOption.timing_H || _htOption.timing || _htOption.autoColorDark;
1224+
lColor = _htOption.timing_H || _htOption.timing || _htOption.autoColorLight;
1225+
} else {
1226+
dColor = _htOption.timing_H || _htOption.timing || _htOption.colorDark;
1227+
}
12221228
} else if (col == 6) {
1223-
dColor = _htOption.timing_V || _htOption.timing ||
1224-
_htOption.colorDark;
1229+
// dColor = _htOption.timing_V || _htOption.timing || _htOption.colorDark;
1230+
if (_htOption.autoColor) {
1231+
dColor = _htOption.timing_V || _htOption.timing || _htOption.autoColorDark;
1232+
lColor = _htOption.timing_V || _htOption.timing || _htOption.autoColorLight;
1233+
} else {
1234+
dColor = _htOption.timing_V || _htOption.timing ||
1235+
_htOption.colorDark;
1236+
}
12251237
} else {
1226-
12271238
if (_htOption.autoColor) {
12281239
dColor = _htOption.autoColorDark;
12291240
lColor = _htOption.autoColorLight;
@@ -1257,8 +1268,15 @@ Drawing.prototype.draw = function(oQRCode) {
12571268
nowDotScale = _htOption.dotScaleAO;
12581269
} else if (type == 'AI') {
12591270
nowDotScale = _htOption.dotScaleAI;
1271+
}
1272+
1273+
if (_htOption.backgroundImage && _htOption.autoColor) {
1274+
dColor = ((eye.type == 'AO') ? _htOption.AI : _htOption.AO) ||
1275+
_htOption.autoColorDark;
1276+
lColor = _htOption.autoColorLight;
12601277
} else {
1261-
nowDotScale = 1;
1278+
dColor = ((eye.type == 'AO') ? _htOption.AI : _htOption.AO) ||
1279+
dColor;
12621280
}
12631281

12641282
_oContext.fillRect(nLeft + nWidth * (1 - nowDotScale) / 2, _htOption.titleHeight + nTop +

index.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)