Commit e14c7968 authored by santiaago's avatar santiaago
Browse files

isogrids are have now lines-6 by default and can be parameterized

parent 6b5dca61
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -15,11 +15,7 @@ import (
func Random(w http.ResponseWriter, r *http.Request) {

	colorMap := colors.MapOfColorThemes()
	size := extract.Size(r)
	numColors := extract.NumColors(r)

	bg, fg := extract.ExtraColors(r, colorMap)

	theme := extract.Theme(r)
	if val, ok := colorMap[theme]; ok {
		bg = val[0]
@@ -29,6 +25,7 @@ func Random(w http.ResponseWriter, r *http.Request) {
	var colors []color.RGBA
	if theme != "base" {
		if _, ok := colorMap[theme]; ok {
			numColors := extract.NumColors(r)
			colors = append(colors, colorMap[theme][0:numColors]...)
		} else {
			colors = append(colors, colorMap["base"]...)
@@ -37,6 +34,8 @@ func Random(w http.ResponseWriter, r *http.Request) {
		colors = append(colors, bg, fg)
	}

	size := extract.Size(r)
	lines := extract.Lines(r)
	write.ImageSVG(w)
	isogrids.Random(w, "", colors, size)
	isogrids.Random(w, "", colors, size, lines)
}
+1 −2
Original line number Diff line number Diff line
@@ -10,11 +10,10 @@ import (
)

// Random creates an isogrids svg image with half diagonals.
func Random(w http.ResponseWriter, key string, colors []color.RGBA, size int) {
func Random(w http.ResponseWriter, key string, colors []color.RGBA, size, lines int) {
	canvas := svg.New(w)
	canvas.Start(size, size)

	lines := 10
	fringeSize := size / lines

	// triangle grid here: