-
-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I try to darken / lighten (0.1, 0.2, ... 0.8) a given color and get some unexpected (?) results. What's going wrong?
...
value := "#ea621f" // 'Red-Orange'
c, err := colorful.Hex(value)
if err != nil {
log.Fatalf("error <%v> at colorful.Hex(), value = %s", err, value)
}
var farbreihe []color.Color
// color properties
isWarm := gamut.Warm(c)
isCool := gamut.Cool(c)
temperature := ""
if isWarm {
temperature = "warm"
} else if isCool {
temperature = "cool"
} else {
temperature = "Unknown Temperature"
}
// color
farbreihe = nil
farbreihe = append(farbreihe, c)
farbreihe = append(farbreihe, gamut.Contrast(c))
Table(buffer, fmt.Sprintf("Color (%s) and most Contrast Color", temperature), farbreihe)
// darker
farbreihe = nil
farbreihe = append(farbreihe, c)
for i := 1; i <= 8; i++ {
percent := 0.1 * float64(i)
farbreihe = append(farbreihe, gamut.Darker(c, percent))
}
Table(buffer, "Darker (darken the given color: 10%, 20%, ...)", farbreihe)
// lighter
farbreihe = nil
farbreihe = append(farbreihe, c)
for i := 1; i <= 8; i++ {
percent := 0.1 * float64(i)
farbreihe = append(farbreihe, gamut.Lighter(c, percent))
}
Table(buffer, "Lighter (lighten the given color: 10%, 20%, ...)", farbreihe)
And that's the result I get (the values for 20%, 30%, ... are unexpected):
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working