bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotations/helpers.js

27 lines
475 B
JavaScript
Raw Normal View History

const colourToHex = (value) => {
let hex;
hex = parseInt(value, 10).toString(16);
while (hex.length < 6) {
hex = `0${hex}`;
}
2016-06-04 06:39:28 +08:00
return `#${hex}`;
2016-06-04 06:39:28 +08:00
};
2017-09-06 09:36:15 +08:00
const getFormattedColor = (color) => {
2017-09-07 03:36:52 +08:00
let _color = color || '0';
2016-06-04 06:39:28 +08:00
if (!_color.toString().match(/#.*/)) {
_color = colourToHex(_color);
2016-06-04 06:39:28 +08:00
}
return _color;
2016-06-04 06:39:28 +08:00
};
const getStrokeWidth = (thickness, slideWidth) => (thickness * slideWidth) / 100;
2016-06-04 06:39:28 +08:00
export default {
2017-09-06 09:36:15 +08:00
getFormattedColor,
2016-06-04 06:39:28 +08:00
getStrokeWidth,
};