A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: migrate color.js to typescript (#2151)
Abdulrehman-Jafera454ec494499
diff --git a/apps/web/src/utils/color.js b/apps/web/src/utils/color.tssimilarity index 59%rename from apps/web/src/utils/color.jsrename to apps/web/src/utils/color.tsindex 3230bdaef..a0c71466e 100644--- a/apps/web/src/utils/color.js+++ b/apps/web/src/utils/color.ts@@ -17,21 +17,22 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-function hexToRGB(hex, alpha = 1) {- let parseString = hex;- if (hex.startsWith("#")) {- parseString = hex.slice(1, 7);+function hexToRGB(hex:string, alpha = 1) {+ let parseString = hex;+ if (hex.startsWith("#")) {+ parseString = hex.slice(1, 7);+ }+ if (parseString.length !== 6) {+ return null;+ }+ const r = parseInt(parseString.slice(0, 2), 16);+ const g = parseInt(parseString.slice(2, 4), 16);+ const b = parseInt(parseString.slice(4, 6), 16);+ if (isNaN(r) || isNaN(g) || isNaN(b)) {+ return null;+ }+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;}- if (parseString.length !== 6) {- return null;- }- const r = parseInt(parseString.slice(0, 2), 16);- const g = parseInt(parseString.slice(2, 4), 16);- const b = parseInt(parseString.slice(4, 6), 16);- if (isNaN(r) || isNaN(g) || isNaN(b)) {- return null;- }- return `rgba(${r}, ${g}, ${b}, ${alpha})`;-}--export { hexToRGB };++ export { hexToRGB };+\ No newline at end of file