update colorizer
parent
57260dfcb4
commit
2adafc0133
|
|
@ -3,6 +3,7 @@ package dao
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -91,7 +92,12 @@ func colorFor(n string) int {
|
||||||
for _, r := range n {
|
for _, r := range n {
|
||||||
sum += int(r)
|
sum += int(r)
|
||||||
}
|
}
|
||||||
return sum % 256
|
|
||||||
|
c := sum % 256
|
||||||
|
if c == 0 {
|
||||||
|
c = 207 + rand.Intn(10)
|
||||||
|
}
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue