Skip to content

Commit 2269745

Browse files
committed
Fix some subtle bugs.
1 parent 322ec81 commit 2269745

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

palette.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ func (p *Palette) ExtractAwesome() map[string]*Swatch {
109109
if darkvib, ok := res["DarkVibrant"]; ok {
110110
h, s, l := rgbToHsl(int(darkvib.Color))
111111
l = TARGET_NORMAL_LUMA
112-
res["Vibrant"] = &Swatch{Color: Color(hslToRgb(h, s, l))}
112+
res["Vibrant"] = &Swatch{Name: "Vibrant", Color: Color(hslToRgb(h, s, l))}
113113
}
114114
}
115115
if _, darkvib := res["DarkVibrant"]; !darkvib {
116116
if vib, ok := res["Vibrant"]; ok {
117117
h, s, l := rgbToHsl(int(vib.Color))
118118
l = TARGET_DARK_LUMA
119-
res["DarkVibrant"] = &Swatch{Color: Color(hslToRgb(h, s, l))}
119+
res["DarkVibrant"] = &Swatch{Name: "DarkVibrant", Color: Color(hslToRgb(h, s, l))}
120120
}
121121
}
122122
return res

webapp.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ func index(w http.ResponseWriter, r *http.Request) {
8787
case "image/jpeg":
8888
case "image/png":
8989
default:
90-
if err != nil {
91-
setStatus(400)
92-
data.Error = "JPG/PNG only plz."
93-
return
94-
}
90+
setStatus(400)
91+
data.Error = "JPG/PNG only plz."
92+
return
9593
}
9694

9795
if max := r.FormValue("maxColors"); max != "" {
@@ -217,7 +215,7 @@ input[type="text"] {
217215
</form>
218216
{{ if .Error }}
219217
<hr>
220-
<h3>Error: {{.Error}}</h3>
218+
<h3>Error: {{.Error}}</h3>
221219
{{ end }}
222220
{{ if .Response }}
223221
<hr>
@@ -267,9 +265,9 @@ h2 {
267265
</figure>
268266
<textarea readonly onclick='this.select()'>{{.Stylesheet}}</textarea>
269267
{{ if .Missing }}
270-
<h3>If color swatches are missing, try increasing <code>maxColors</code> in the text field above.</h3>
271-
<h2>{{.Benchmark}}</h2>
268+
<h3>If color swatches are missing, try increasing <code>maxColors</code> in the text field above.</h3>
272269
{{ end }}
270+
<h2>{{.Benchmark}}</h2>
273271
{{ end }}
274272
</body>
275273
</html>`

0 commit comments

Comments
 (0)