Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

update thumbnail, add hexToRgb util function

Amruth Pillaif87b5ed6a60f
diff --git a/firebase.json b/firebase.json
index 340ed5b73..cd83b60c9 100644
--- a/firebase.json
+++ b/firebase.json
@@ -13,4 +13,4 @@
}
]
}
-}
+}
\ No newline at end of file
diff --git a/public/images/thumbnail.png b/public/images/thumbnail.png
index d54c2b463..81cf904b4 100644
Binary files a/public/images/thumbnail.png and b/public/images/thumbnail.png differ
diff --git a/src/utils/index.js b/src/utils/index.js
index 7db286e7a..7e4253ea7 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,5 +1,3 @@
-/* eslint-disable import/prefer-default-export */
-
const move = (array, element, delta) => {
const index = array.indexOf(element);
const newIndex = index + delta;
@@ -8,6 +6,19 @@ const move = (array, element, delta) => {
array.splice(indexes[0], 2, array[indexes[1]], array[indexes[0]]);
};
+const hexToRgb = hex => {
+ const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
+ hex = hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ return result
+ ? {
+ r: parseInt(result[1], 16),
+ g: parseInt(result[2], 16),
+ b: parseInt(result[3], 16),
+ }
+ : null;
+};
+
const copyToClipboard = text => {
const textArea = document.createElement('textarea');
textArea.style.position = 'fixed';
@@ -29,4 +40,4 @@ const copyToClipboard = text => {
return successful;
};
-export { move, copyToClipboard };
+export { move, hexToRgb, copyToClipboard };