module.exports = (red, green, blue, preferShorthand = false) => {
let colours = [red, green, blue].map(value => value.toString(16));
let canBeCondensed = colours.every(value => value.charAt(0) === value.charAt(1));
if (canBeCondensed && preferShorthand) {
colours = colours.map(v => v.charAt(0));
}
return '#' + colours.join('');
};