Color swatches
This commit is contained in:
parent
21bea1f92a
commit
7ff3bbd0e1
20
index.js
20
index.js
@ -1,6 +1,9 @@
|
||||
const WIDTH = 4; //64;
|
||||
const HEIGHT = 4; //32;
|
||||
|
||||
// Canvas
|
||||
const canvas = document.createElement('div');
|
||||
canvas.className = 'canvas';
|
||||
for(let y = 0; y < HEIGHT; y++) {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'row';
|
||||
@ -12,5 +15,18 @@ for(let y = 0; y < HEIGHT; y++) {
|
||||
});
|
||||
row.appendChild(pixel);
|
||||
}
|
||||
document.body.appendChild(row);
|
||||
}
|
||||
canvas.appendChild(row);
|
||||
}
|
||||
document.body.appendChild(canvas);
|
||||
|
||||
// Palette
|
||||
const colors = ['red', 'blue'];
|
||||
const palette = document.createElement('div');
|
||||
palette.className = 'palette';
|
||||
for(let color of colors) {
|
||||
const swatch = document.createElement('div');
|
||||
swatch.className = 'swatch';
|
||||
swatch.style.backgroundColor = color;
|
||||
palette.appendChild(swatch);
|
||||
}
|
||||
document.body.appendChild(palette);
|
Loading…
x
Reference in New Issue
Block a user