Skip to content

Commit b12cbb3

Browse files
authored
Merge pull request #201 from litecanvas/patch
Patch
2 parents 5c90bea + 7e2a31e commit b12cbb3

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
"types": "./types/index.d.ts",
2020
"unpkg": "./dist/dist.dev.js",
2121
"keywords": [
22-
"game engine",
23-
"game development",
24-
"2d",
22+
"tiny",
23+
"micro",
24+
"javascript",
25+
"html5",
2526
"canvas",
27+
"2d",
28+
"game",
2629
"gamedev",
2730
"js13k",
28-
"creative-coding",
29-
"pico-8",
30-
"p5"
31+
"creative coding"
3132
],
3233
"devDependencies": {
3334
"@litecanvas/jsdom-extras": "^2.0.0",

samples/colors/colors.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ litecanvas({
99
height: tile * rows,
1010
autoscale: false,
1111
animate: false,
12+
canvas: 'canvas',
1213
})
1314

1415
// draw the color palette
@@ -24,7 +25,7 @@ function draw() {
2425

2526
if (showLabel) {
2627
const label = c
27-
text(i * tile + tile / 2, 2 + j * tile + tile / 2, label, fg)
28+
// text(i * tile + tile / 2, 2 + j * tile + tile / 2, label, fg)
2829
}
2930
}
3031
}
@@ -34,3 +35,11 @@ function tapped() {
3435
showLabel = !showLabel
3536
draw()
3637
}
38+
39+
// download button
40+
document.querySelector('#download').onclick = () => {
41+
var link = document.createElement('a')
42+
link.download = 'litecanvas-colors.png'
43+
link.href = canvas().toDataURL()
44+
link.click()
45+
}

samples/colors/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
</style>
1717
</head>
1818
<body>
19-
<!-- <script src="https://unpkg.com/litecanvas/dist/dist.js"></script> -->
19+
<canvas></canvas>
20+
<p><button id="download">Download</button></p>
2021
<script src="../../dist/dist.dev.js"></script>
2122
<script src="colors.js"></script>
2223
</body>

src/version.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)