Commit 2be18223 authored by santiaago's avatar santiaago
Browse files

all color routes support color list override.

Fixes #62
parent f1cf339e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ func BannerRandomGradient(w http.ResponseWriter, r *http.Request) {
		colors = append(colors, bg, fg)
	}

	if newColors, err := extract.Colors(r); err == nil {
		colors = newColors
	}

	xt := extract.XTriangles(r)
	write.ImageSVG(w)
	isogrids.RandomGradient(w, "", colors, width, height, xt)
+10 −0
Original line number Diff line number Diff line
@@ -38,6 +38,16 @@ func BannerGradient(w http.ResponseWriter, r *http.Request) {
		colors = append(colors, bg, fg)
		gColors = []color.RGBA{bg, fg}
	}

	if newColors, err := extract.Colors(r); err == nil {
		colors = newColors
		if len(colors) > 2 {
			gColors = colors[1:3]
		} else {
			gColors = colors
		}
	}

	prob := extract.Probability(r, 1/float64(len(colors)))

	write.ImageSVG(w)
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ func Hexa(w http.ResponseWriter, r *http.Request) {
	} else {
		colors = append(colors, bg, fg)
	}

	if newColors, err := extract.Colors(r); err == nil {
		colors = newColors
	}

	write.ImageSVG(w)
	isogrids.Hexa(w, key, colors, size, lines)
}
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@ func Isogrids(w http.ResponseWriter, r *http.Request) {
		colors = append(colors, bg, fg)
	}

	if newColors, err := extract.Colors(r); err == nil {
		colors = newColors
	}

	size := extract.Size(r)
	lines := extract.Lines(r)

+5 −0
Original line number Diff line number Diff line
@@ -33,6 +33,11 @@ func Random(w http.ResponseWriter, r *http.Request) {
	} else {
		colors = append(colors, bg, fg)
	}

	if newColors, err := extract.Colors(r); err == nil {
		colors = newColors
	}

	prob := extract.Probability(r, 1/float64(len(colors)))

	size := extract.Size(r)
Loading