mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Reverse QR code colors and add padding
All QR scanners should be able to recognize this, as it is now the correct color with some padding to prevent blending. Signed-off-by: swirl <swurl@swurl.xyz>
This commit is contained in:
parent
9a9a97868d
commit
d64cb38240
@ -9778,4 +9778,3 @@ cmd_mood(ProfWin* window, const char* const command, gchar** args)
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,15 +880,28 @@ cons_show_omemo_qrcode(const char* const text)
|
|||||||
|
|
||||||
char buf[(width * 4) + 1];
|
char buf[(width * 4) + 1];
|
||||||
memset(buf, 0, sizeof buf);
|
memset(buf, 0, sizeof buf);
|
||||||
|
|
||||||
|
char tmp[(width * 4) + 5];
|
||||||
|
memset(tmp, 0, sizeof tmp);
|
||||||
|
|
||||||
|
for (int i = 0; i < width + 2 * ZOOM_SIZE; i += ZOOM_SIZE) {
|
||||||
|
strcat(tmp, "\u2588\u2588");
|
||||||
|
}
|
||||||
|
|
||||||
|
win_println(console, THEME_DEFAULT, "", tmp);
|
||||||
for (size_t y = 0; y < width; y += ZOOM_SIZE) {
|
for (size_t y = 0; y < width; y += ZOOM_SIZE) {
|
||||||
for (size_t x = 0; x < width; x += ZOOM_SIZE) {
|
for (size_t x = 0; x < width; x += ZOOM_SIZE) {
|
||||||
strcat(buf, (*data & 1) ? "\u2588\u2588" : "\u2800\u2800");
|
strcat(buf, !(*data & 1) ? "\u2588\u2588" : "\u2800\u2800");
|
||||||
|
|
||||||
data++;
|
data++;
|
||||||
}
|
}
|
||||||
win_println(console, THEME_DEFAULT, "", "%s", buf);
|
|
||||||
|
// The extra squares are for padding, so that the QR code doesn't
|
||||||
|
// "blend in" with the rest of the terminal window.
|
||||||
|
win_println(console, THEME_DEFAULT, "", "\u2588\u2588%s\u2588\u2588", buf);
|
||||||
memset(buf, 0, sizeof buf);
|
memset(buf, 0, sizeof buf);
|
||||||
}
|
}
|
||||||
|
win_println(console, THEME_DEFAULT, "", "%s", tmp);
|
||||||
|
|
||||||
QRcode_free(qrcode);
|
QRcode_free(qrcode);
|
||||||
#endif
|
#endif
|
||||||
@ -2926,4 +2939,3 @@ cons_remove_alert(ProfWin* window)
|
|||||||
g_list_free_full(item, g_free);
|
g_list_free_full(item, g_free);
|
||||||
free(win_name);
|
free(win_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user