Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created June 27, 2021 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/ad14942a434afda8e8ddb0237f3ffc4b to your computer and use it in GitHub Desktop.
Save parzibyte/ad14942a434afda8e8ddb0237f3ffc4b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--Puedes descargar el script e incluirlo de manera local si así prefieres-->
<script src="https://unpkg.com/qrious@4.0.2/dist/qrious.js"></script>
<title>Generar códigos QR - By Parzibyte</title>
</head>
<body>
<h1>Generando códigos QR desde parzibyte.me</h1>
<a href="//parzibyte.me/blog">By Parzibyte</a>
<br>
<img alt="Código QR" id="codigo">
<br>
<button id="btnDescargar">Descargar</button>
<script>
const $imagen = document.querySelector("#codigo"),
$boton = document.querySelector("#btnDescargar");
new QRious({
element: $imagen,
value: "https://parzibyte.me/blog", // La URL o el texto
size: 500,
backgroundAlpha: 0, // 0 para fondo transparente
foreground: "#8bc34a", // Color del QR
level: "H", // Puede ser L,M,Q y H (L es el de menor nivel, H el mayor)
});
$boton.onclick = () => {
const enlace = document.createElement("a");
enlace.href = $imagen.src;
enlace.download = "Código QR generado desde parzibyte.me.png";
enlace.click();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment