Closed Baggerone closed 7 years ago
Yes, the package can handle this, although "grid of colors" is a bit ambiguous. Take a look at https://speakerdeck.com/ajstarks/svgo-code-plus-picture-examples
Here is one (page 10) (Also note that a version is included in the package (along with other examples). See the richter directory
package main
import (
"math/rand"
"os"
"time"
"github.com/ajstarks/svgo"
)
var (
canvas = svg.New(os.Stdout)
width = 500
height = 500
)
// inspired by Gerhard Richter's 256 colors, 1974
func main() {
rand.Seed(time.Now().Unix())
canvas.Start(width, height)
canvas.Rect(0, 0, width, height)
w, h, gutter := 24, 18, 5
rows, cols := 16, 16
top, left := 20, 20
for r, x := 0, left; r < rows; r++ {
for c, y := 0, top; c < cols; c++ {
canvas.Rect(x, y, w, h,
canvas.RGB(rand.Intn(255), rand.Intn(255), rand.Intn(255)))
y += (h + gutter)
}
x += (w + gutter)
}
canvas.End()
}
Hi, As a kind of exercise, I've written some Go code that takes a grid of colors and produces simple xml for an svg of the same image.
Does your package include that functionality? If not, if I were to create a pull request, would you have time to evaluate it and decide whether to include it?
I could make a separate repo just for my code, but someone suggested I check with you first.
Thanks for your consideration.