feat: receives text, title and icon colors from URL

This commit is contained in:
JoaoVSouto
2020-07-11 16:01:44 -03:00
parent c25319ee6c
commit 59b8bded9c
3 changed files with 34 additions and 6 deletions
+7 -1
View File
@@ -25,4 +25,10 @@ function kFormatter(num) {
: Math.sign(num) * Math.abs(num);
}
module.exports = { renderError, kFormatter, encodeHTML };
function isValidHexColor(hexColor) {
return new RegExp(
/^([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{4})$/
).test(hexColor);
}
module.exports = { renderError, kFormatter, encodeHTML, isValidHexColor };