Skip to content

Commit f69a536

Browse files
committed
Update to make random color more discrete
1 parent a8c12d0 commit f69a536

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

lib/realtime.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -756,13 +756,11 @@ function connection(socket) {
756756

757757
//initialize user data
758758
//random color
759-
var color = randomcolor({
760-
luminosity: 'light'
761-
});
759+
var color = randomcolor();
762760
//make sure color not duplicated or reach max random count
763761
if (notes[noteId]) {
764762
var randomcount = 0;
765-
var maxrandomcount = 5;
763+
var maxrandomcount = 10;
766764
var found = false;
767765
do {
768766
Object.keys(notes[noteId].users).forEach(function (user) {
@@ -772,9 +770,7 @@ function connection(socket) {
772770
}
773771
});
774772
if (found) {
775-
color = randomcolor({
776-
luminosity: 'light'
777-
});
773+
color = randomcolor();
778774
randomcount++;
779775
}
780776
} while (found && randomcount < maxrandomcount);

public/js/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ var supportExtraTags = [
184184
text: '[random color tag]',
185185
search: '[]',
186186
command: function () {
187-
var color = randomColor({
188-
luminosity: 'light'
189-
});
187+
var color = randomColor();
190188
return '[color=' + color + ']';
191189
}
192190
}

0 commit comments

Comments
 (0)