Skip to content

Hcl seems to be broken #14

@mbertschler

Description

@mbertschler

Hi and thanks for this libary, it looks pretty useful! I generated a gradient over the hues 0 to 360 with the Hcl function, and the output looks wrong. Using the Hsl or Hsv functions causes no problems. Here is my rainbow gradient:

screen shot 2017-07-27 at 00 41 51

The code I used to produce this image using a HTML file that I opened in my browser:

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"os"

	"github.com/lucasb-eyer/go-colorful"
)

func main() {
	var out = `<html><head></head><body>`
	for hue := 0; hue < 360; hue++ {
		col := colorful.Hsv(float64(hue), 1, 1)
		r, g, b := col.RGB255()
		out += fmt.Sprintf(`<div style="width:1000px;height:2px;`+
			`background-color:rgb(%d,%d,%d)"></div>`, r, g, b)
	}
	out += "</body></html>"
	err := ioutil.WriteFile(os.ExpandEnv("$HOME/tmp/rgbdebug.html"), []byte(out), 0644)
	if err != nil {
		log.Println(err)
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions