client/annotviz/app/js/utils.js
changeset 119 e6605fecb175
parent 105 25ac8802c189
child 122 3b11017a76a4
equal deleted inserted replaced
118:8acdf12aa016 119:e6605fecb175
    12 	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
    12 	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
    13 	var seconds = Math.floor( (ts/1000) % 60);
    13 	var seconds = Math.floor( (ts/1000) % 60);
    14 	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
    14 	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
    15 }
    15 }
    16 
    16 
       
    17 function colorToHex(c) {
       
    18 	var m = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c);
       
    19 	return m ? '#' + (1 << 24 | m[1] << 16 | m[2] << 8 | m[3]).toString(16).substr(1) : c;
       
    20 }
       
    21 
       
    22 
    17 
    23 
    18 module.exports = {
    24 module.exports = {
    19 	formatTime: formatTime
    25 	formatTime: formatTime,
       
    26 	colorToHex: colorToHex
    20 };
    27 };