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

33 lines
535 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
};
const formatColor = (color) => {
let _color;
2016-06-04 06:39:28 +08:00
if (!color) {
_color = '0'; // default value
} else {
_color = color;
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 {
formatColor,
getStrokeWidth,
};