Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to set background color, and always folow colorLight #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions dist/awesome-qr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
}
} else {
_bContext.rect(0, 0, size, size);
_bContext.fillStyle = "#ffffff";
_bContext.fillStyle = _htOption.backgroundColor;
_bContext.fill();
}

Expand Down Expand Up @@ -1893,7 +1893,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
var nTop = row * nSize + (bProtected ? 0 : (xyOffset * nSize));
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.lineWidth = 0.5;
_oContext.fillStyle = bIsDark ? _htOption.colorDark : "rgba(255, 255, 255, 0.6)"; //_htOption.colorLight;
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
if (agnPatternCenter.length === 0) {
// if align pattern list is empty, then it means that we don't need to leave room for the align patterns
if (!bProtected)
Expand All @@ -1907,7 +1907,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
}

// Draw POSITION protectors
var protectorStyle = "rgba(255, 255, 255, 0.6)";
var protectorStyle = _htOption.colorLight;
_oContext.fillStyle = protectorStyle;
_oContext.fillRect(0, 0, 8 * nSize, 8 * nSize);
_oContext.fillRect(0, (nCount - 8) * nSize, 8 * nSize, 8 * nSize);
Expand Down Expand Up @@ -1966,7 +1966,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
} else if (agnY === 6 && (agnX === 6 || agnX === edgeCenter)) {
continue;
} else if (agnX !== 6 && agnX !== edgeCenter && agnY !== 6 && agnY !== edgeCenter) {
_oContext.fillStyle = "rgba(0, 0, 0, .2)";
_oContext.fillStyle = _htOption.colorLight;
_drawAlign(_oContext, agnX, agnY, nSize, nSize);
} else {
_oContext.fillStyle = _htOption.colorDark;
Expand All @@ -1977,7 +1977,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {

// Fill the margin
if (whiteMargin) {
_oContext.fillStyle = '#FFFFFF';
_oContext.fillStyle = _htOption.backgroundColor;
_oContext.fillRect(-margin, -margin, size, margin);
_oContext.fillRect(-margin, viewportSize, size, margin);
_oContext.fillRect(viewportSize, -margin, margin, size);
Expand All @@ -2004,7 +2004,7 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
var x = 0.5 * (size - logoSize);
var y = x;

_oContext.fillStyle = '#FFFFFF';
_oContext.fillStyle = _htOption.logoBackgroundColor;
_oContext.save();
_prepareRoundedCornerClip(_oContext, x - logoMargin, y - logoMargin, logoSize + 2 * logoMargin, logoSize + 2 * logoMargin, logoCornerRadius);
_oContext.clip();
Expand Down Expand Up @@ -2266,14 +2266,16 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
margin: 20,
typeNumber: 4,
colorDark: "#000000",
colorLight: "#ffffff",
colorLight: "rgba(255, 255, 255, 0.6)",
correctLevel: QRErrorCorrectLevel.M,
backgroundImage: undefined,
backgroundDimming: 'rgba(0,0,0,0)',
backgroundDimming: 'rgba(0, 0, 0, 0)',
logoImage: undefined,
logoScale: 0.2,
logoMargin: 6,
logoCornerRadius: 8,
logoBackgroundColor: '#ffffff',
backgroundColor: '#ffffff',
whiteMargin: true,
dotScale: 0.35,
maskedDots: false,
Expand Down Expand Up @@ -2425,4 +2427,4 @@ require([__awesome_qr_base_path+'/gif'], function (gifEncoder) {
}
})(this, function() {
return new AwesomeQRCode();
});
});