Skip to content

Commit

Permalink
better colorFromName
Browse files Browse the repository at this point in the history
  • Loading branch information
runix committed Apr 16, 2012
1 parent 28fdf9f commit 58fd2c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions javascripts/preprocess.js
Expand Up @@ -69,7 +69,7 @@ function mergeSegments(events, places_position){
return result;
}
function colorFromName(texto) {
var r="#"+intToARGB(hashCode(texto))
var r=intToARGB(hashCode(texto))
return r
}
function hashCode(str) { // java String#hashCode
Expand All @@ -81,7 +81,7 @@ function hashCode(str) { // java String#hashCode
}

function intToARGB(i){
return ((i>>16)&0xFF).toString(16) +
((i>>8)&0xFF).toString(16) +
(i&0xFF).toString(16);
return "rgb("+((i&0xFF)) +"," +
((i>>16)&0xFF) +"," +
((i>>8)&0xFF) + ")"
}

0 comments on commit 58fd2c5

Please sign in to comment.