Fixed bug with converting short hex color to long

main
Anton Novojilov 3 years ago
parent 7d7fe9553d
commit c51dec7916

@ -220,7 +220,9 @@ func formatColor(c string) string {
// Short hex
if len(c) == 3 {
c = c + c
c = strings.Repeat(string(c[0]), 2) +
strings.Repeat(string(c[1]), 2) +
strings.Repeat(string(c[2]), 2)
}
return c

@ -148,7 +148,7 @@ func (s *BadgeSuite) TestBlackAndWhite(c *C) {
func (s *BadgeSuite) TestAux(c *C) {
c.Assert(formatColor("000000"), Equals, "000000")
c.Assert(formatColor("#000000"), Equals, "000000")
c.Assert(formatColor("#000"), Equals, "000000")
c.Assert(formatColor("#4c1"), Equals, "44cc11")
c.Assert(calcLumColor(0.7), Equals, 0.4479884124418833)
c.Assert(calcLumColor(0.01), Equals, 0.0007739938080495357)

Loading…
Cancel
Save