You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
It looks like the fix is fairly simple (add 0.5 to all the values from RGB255 before converting to uint8, same as what Hex does), but the tests are painful because they don't line up with the other values (turns out using numbers that aren't as clean for input means you don't get numbers as clean in the output ☹️ ) and there are no tests covering RGBA or RGB255.
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:
As you can see the input value is
#4a4543
but (on my machine) it outputs#494543
.The text was updated successfully, but these errors were encountered: