A web-based drawing app
git clone git://soophie.de/outline
blob: b8483883382352ef9ac13125ec3b85f98467ee7f (450 bytes)[doc][blame][raw]
1
export default {2
uuid: function() {3
return 'xxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {4
let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);5
return v.toString(16);6
});7
},8
luma: function(color) {9
color = color.substr(1);10
let r = parseInt(color.substr(0, 2), 16);11
let g = parseInt(color.substr(2, 4), 16);12
let b = parseInt(color.substr(4, 6), 16);13
return ((r * 0.299) + (g * 0.587) + (b * 0.114)) > 50;14
}15
};