Skip to content

Importing using Hex and exporting using RGB255 does not always return the correct values #12

Closed
@belak

Description

@belak

Ran into an example with the base16-builder-go where grabbing a value from a hex string and then outputting the rgb values then converting them back to hex isn't matching up.

Here's an example:

package main

import (
	"fmt"

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

func main() {
	color, _ := colorful.Hex("#4a4543")
	r, g, b := color.RGB255()
	fmt.Printf("#%02x%02x%02x\n", r, g, b)
}

As you can see the input value is #4a4543 but (on my machine) it outputs #494543.

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