<!DOCTYPE html>
<html lang="vi">
<meta charset="utf-8">
<title>Rìu chéo 16×16</title>
<style>
  canvas {
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
  }
  a { display: block; }
</style>

<canvas id="axe" width="16" height="16"></canvas>
<a id="save" download="riu-cheo-16x16.png">Tải PNG 16×16</a>

<script>
const pixels = [
  "................",
  "..###......###..",
  ".#LLs#....#sLL#.",
  "#LLssD#..#DssLL#",
  "#LssDw#..#wDssL#",
  "#ssD#w#..#w#Dss#",
  ".##..#w##W#..##.",
  "......#wW#......",
  "......#Ww#......",
  ".....#W##w#.....",
  "....#W#..#w#....",
  "...#W#....#w#...",
  "..#W#......#w#..",
  ".#W#........#w#.",
  "..#..........#..",
  "................"
];

const palette = {
  "#": "#202634", // Viền
  "L": "#eff8ff", // Ánh sáng trên lưỡi
  "s": "#a9bac9", // Thép
  "D": "#607185", // Bóng thép
  "w": "#a66a35", // Gỗ
  "W": "#d59b52"  // Gỗ sáng
};

const canvas = document.getElementById("axe");
const ctx = canvas.getContext("2d");

pixels.forEach((row, y) => {
  [...row].forEach((pixel, x) => {
    const color = palette[pixel];
    if (!color) return; // Điểm trong suốt
    ctx.fillStyle = color;
    ctx.fillRect(x, y, 1, 1);
  });
});

document.getElementById("save").href = canvas.toDataURL("image/png");
</script>
</html>
