stickergen

command module
v0.0.0-...-4c7d369 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2018 License: MIT Imports: 7 Imported by: 0

README

This is a toy app which generates pixel grids, like so:

pixel grid

For more context, check out the Generative Laptop Skin post on my blog.

It comes with a CLI app (stickergen) and has been transpiled to javascript with gopherjs so it can be embedded in web apps.

Command line options:

  --rows value, -r value      (default: 50)
  --cols value, -c value      (default: 72)
  --cellsize value, -s value  (default: 35)
  --outfile value, -o value   (default: "output.png")
  --palette value, -p value   (default: "random")

To use javascript, include the script:

<script src="stickergen.js"></script>

And then call the function:

var img = generateImage(rows, columns, cellsize, firstColor, secondColor)

The returned value is a Data URI encoded PNG, so can be assigned as the src attribute of an img element. Example usage:

<img id="targetImg"></img>

...
myImg = document.getElementById("targetImg")
myImg.src = generateImage(40, 80, 9, "#f21326", "#eac4f9")

There is a more fully worked example in index.html in this repository.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
stickergen command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL