<div class="heatmap-card">
<h3>Contribution Activity</h3>
<div class="heatmap-grid" id="heatmap-grid"></div>
<div class="heatmap-legend">
<span>Less</span>
<div class="legend-box level-0"></div>
<div class="legend-box level-1"></div>
<div class="legend-box level-2"></div>
<div class="legend-box level-3"></div>
<div class="legend-box level-4"></div>
<span>More</span>
</div>
</div>*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background: #f9fafb;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
}
.heatmap-card {
background: #ffffff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
overflow-x: auto;
}
.heatmap-card h3 {
margin-top: 0;
margin-bottom: 20px;
color: #111827;
font-size: 1.125rem;
}
.heatmap-grid {
display: grid;
grid-auto-flow: column;
grid-template-rows: repeat(7, 1fr);
gap: 4px;
}
.heat-box, .legend-box {
width: 14px;
height: 14px;
border-radius: 3px;
background-color: #ebedf0;
}
.level-1 { background-color: #9be9a8; }
.level-2 { background-color: #40c463; }
.level-3 { background-color: #30a14e; }
.level-4 { background-color: #216e39; }
.heatmap-legend {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
margin-top: 20px;
font-size: 0.875rem;
color: #6b7280;
}const grid = document.getElementById("heatmap-grid");
for (let i = 0; i < 365; i++) {
const box = document.createElement("div");
box.className = "heat-box";
const randomValue = Math.random();
if (randomValue > 0.9) {
box.classList.add("level-4");
} else if (randomValue > 0.7) {
box.classList.add("level-3");
} else if (randomValue > 0.4) {
box.classList.add("level-2");
} else if (randomValue > 0.2) {
box.classList.add("level-1");
}
grid.appendChild(box);
}Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.