mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
Update to make random color more discrete
This commit is contained in:
parent
a8c12d0d21
commit
f69a5361cb
2 changed files with 4 additions and 10 deletions
|
@ -756,13 +756,11 @@ function connection(socket) {
|
||||||
|
|
||||||
//initialize user data
|
//initialize user data
|
||||||
//random color
|
//random color
|
||||||
var color = randomcolor({
|
var color = randomcolor();
|
||||||
luminosity: 'light'
|
|
||||||
});
|
|
||||||
//make sure color not duplicated or reach max random count
|
//make sure color not duplicated or reach max random count
|
||||||
if (notes[noteId]) {
|
if (notes[noteId]) {
|
||||||
var randomcount = 0;
|
var randomcount = 0;
|
||||||
var maxrandomcount = 5;
|
var maxrandomcount = 10;
|
||||||
var found = false;
|
var found = false;
|
||||||
do {
|
do {
|
||||||
Object.keys(notes[noteId].users).forEach(function (user) {
|
Object.keys(notes[noteId].users).forEach(function (user) {
|
||||||
|
@ -772,9 +770,7 @@ function connection(socket) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (found) {
|
if (found) {
|
||||||
color = randomcolor({
|
color = randomcolor();
|
||||||
luminosity: 'light'
|
|
||||||
});
|
|
||||||
randomcount++;
|
randomcount++;
|
||||||
}
|
}
|
||||||
} while (found && randomcount < maxrandomcount);
|
} while (found && randomcount < maxrandomcount);
|
||||||
|
|
|
@ -184,9 +184,7 @@ var supportExtraTags = [
|
||||||
text: '[random color tag]',
|
text: '[random color tag]',
|
||||||
search: '[]',
|
search: '[]',
|
||||||
command: function () {
|
command: function () {
|
||||||
var color = randomColor({
|
var color = randomColor();
|
||||||
luminosity: 'light'
|
|
||||||
});
|
|
||||||
return '[color=' + color + ']';
|
return '[color=' + color + ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue