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
fix color shade
ammarahm-ed212fde442754
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 011d42f8c..29ccfd212 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -6,6 +6,7 @@ import {TextInput,TouchableOpacity,View,+ Platform,} from 'react-native';import FastStorage from 'react-native-fast-storage';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';@@ -26,7 +27,7 @@ import {useTracked} from '../../provider';import {ACTIONS} from '../../provider/actions';import {moveNoteEvent} from '../DialogManager';import Share from 'react-native-share';-import {timeConverter, ToastEvent} from '../../utils/utils';+import {timeConverter, ToastEvent, hexToRGBA} from '../../utils/utils';import NavigationService from '../../services/NavigationService';const w = Dimensions.get('window').width;const h = Dimensions.get('window').height;@@ -737,7 +738,9 @@ export const ActionSheetComponent = ({marginRight: 3,paddingHorizontal: 5,paddingVertical: 1,- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),borderRadius: 2.5,}}><Textdiff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.jsindex 2d534ae13..62559dc70 100644--- a/apps/mobile/src/components/DialogManager/index.js+++ b/apps/mobile/src/components/DialogManager/index.js@@ -31,7 +31,8 @@ import {Dialog} from '../Dialog';import LoginDialog from '../LoginDialog';import MoveNoteDialog from '../MoveNoteDialog';import {VaultDialog} from '../VaultDialog';-import {timeConverter} from '../../utils/utils';+import {timeConverter, hexToRGBA} from '../../utils/utils';+import {Platform} from 'react-native';export const dialogActions = {ACTION_DELETE: 511,@@ -403,7 +404,11 @@ export class DialogManager extends Component {marginBottom: DDS.isTab ? 50 : 0,}}extraScroll={DDS.isTab ? 50 : 0}- indicatorColor={colors.shade}+ indicatorColor={+ Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade)+ }footerAlwaysVisible={DDS.isTab}footerHeight={DDS.isTab ? 20 : 10}footerStyle={diff --git a/apps/mobile/src/components/EditorMenu/index.js b/apps/mobile/src/components/EditorMenu/index.jsindex 569549542..1cb18be56 100644--- a/apps/mobile/src/components/EditorMenu/index.js+++ b/apps/mobile/src/components/EditorMenu/index.js@@ -24,7 +24,7 @@ import {useTracked} from '../../provider';import {ACTIONS} from '../../provider/actions';import {AnimatedSafeAreaView} from '../../views/Home';import {db} from '../../../App';-import {w} from '../../utils/utils';+import {w, hexToRGBA} from '../../utils/utils';let tagsInputRef;let tagsList;@@ -281,7 +281,9 @@ export const EditorMenu = ({updateProps = () => {}, timestamp}) => {style={{height: '100%',opacity: 1,- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),}}><KeyboardAvoidingViewstyle={{height: '100%', paddingHorizontal: 12, width: '100%'}}diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.jsindex 5e0345433..4849cfe85 100644--- a/apps/mobile/src/components/ListPlaceholders/index.js+++ b/apps/mobile/src/components/ListPlaceholders/index.js@@ -1,5 +1,5 @@import React from 'react';-import {Text, View} from 'react-native';+import {Text, View, Platform} from 'react-native';import * as Animatable from 'react-native-animatable';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {SIZE, WEIGHT, normalize} from '../../common/common';@@ -10,7 +10,7 @@ import {slideLeft,slideRight,} from '../../utils/animations';-import {w} from '../../utils/utils';+import {w, hexToRGBA} from '../../utils/utils';export const NotebookPlaceHolder = ({colors, animation}) => {return (@@ -23,7 +23,9 @@ export const NotebookPlaceHolder = ({colors, animation}) => {easing="ease-in"useNativeDriver={true}style={{- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),width: '50%',padding: 5,borderRadius: 5,@@ -539,7 +541,9 @@ export const TrashPlaceHolder = ({colors, animation}) => {style={{width: 80,height: 100,- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),borderRadius: 5,zIndex: 10,}}>diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.jsindex 73db82142..d63cfc5ad 100644--- a/apps/mobile/src/components/Menu/index.js+++ b/apps/mobile/src/components/Menu/index.js@@ -29,7 +29,7 @@ import {ACTIONS} from '../../provider/actions';import {eSendEvent} from '../../services/eventManager';import {eOpenModalMenu, eSendSideMenuOverlayRef} from '../../services/events';import NavigationService from '../../services/NavigationService';-import {timeSince, getElevation} from '../../utils/utils';+import {timeSince, getElevation, hexToRGBA} from '../../utils/utils';export const Menu = ({close = () => {},@@ -545,7 +545,9 @@ export const Menu = ({style={{width: '100%',borderRadius: 5,- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),}}><Viewstyle={{diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.jsindex 07bda186e..7fb337ae9 100644--- a/apps/mobile/src/components/NotesList/index.js+++ b/apps/mobile/src/components/NotesList/index.js@@ -13,7 +13,7 @@ import {useTracked} from '../../provider';import {ACTIONS} from '../../provider/actions';import {eSendEvent} from '../../services/eventManager';import {eScrollEvent} from '../../services/events';-import {ToastEvent} from '../../utils/utils';+import {ToastEvent, hexToRGBA} from '../../utils/utils';import {NotesPlaceHolder} from '../ListPlaceholders';import NoteItem from '../NoteItem';import SelectionWrapper from '../SelectionWrapper';@@ -265,7 +265,9 @@ const PinnedItems = () => {<NoteItemcolors={colors}customStyle={{- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),width: '100%',paddingHorizontal: 12,paddingTop: 20,diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.jsindex 64f2734cf..b6b39f0ff 100755--- a/apps/mobile/src/utils/utils.js+++ b/apps/mobile/src/utils/utils.js@@ -148,3 +148,36 @@ export const SideMenuEvent = {eSendEvent(eEnableGestures);},};++const isValidHex = hex => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);++const getChunksFromString = (st, chunkSize) =>+ st.match(new RegExp(`.{${chunkSize}}`, 'g'));++const convertHexUnitTo256 = hexStr =>+ parseInt(hexStr.repeat(2 / hexStr.length), 16);++const getAlphafloat = (a, alpha) => {+ if (typeof a !== 'undefined') {+ return a / 256;+ }+ if (typeof alpha !== 'undefined') {+ if (1 < alpha && alpha <= 100) {+ return alpha / 100;+ }+ if (0 <= alpha && alpha <= 1) {+ return alpha;+ }+ }+ return 1;+};++export const hexToRGBA = (hex, alpha) => {+ if (!isValidHex(hex)) {+ throw new Error('Invalid HEX');+ }+ const chunkSize = Math.floor((hex.length - 1) / 3);+ const hexArr = getChunksFromString(hex.slice(1), chunkSize);+ const [r, g, b, a] = hexArr.map(convertHexUnitTo256);+ return `rgba(${r}, ${g}, ${b}, ${getAlphafloat(a, alpha)})`;+};diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.jsindex 01a4452d0..518540564 100644--- a/apps/mobile/src/views/Settings/index.js+++ b/apps/mobile/src/views/Settings/index.js@@ -5,6 +5,7 @@ import {View,ScrollView,StatusBar,+ Platform,} from 'react-native';import {opacity,@@ -20,7 +21,7 @@ import {import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import Container from '../../components/Container';import {useTracked} from '../../provider';-import {w} from '../../utils/utils';+import {w, hexToRGBA} from '../../utils/utils';import {ACTIONS} from '../../provider/actions';import FastStorage from 'react-native-fast-storage';export const Settings = ({navigation}) => {@@ -89,7 +90,9 @@ export const Settings = ({navigation}) => {flexWrap: 'wrap',}}style={{- backgroundColor: colors.shade,+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),borderRadius: 5,padding: 5,marginTop: 10,@@ -176,56 +179,6 @@ export const Settings = ({navigation}) => {/></TouchableOpacity>- <TouchableOpacity- onPress={() => {- if (!colors.night) {- FastStorage.setItem('theme', JSON.stringify({night: true}));- changeColorScheme(COLOR_SCHEME_DARK);- } else {- FastStorage.setItem('theme', JSON.stringify({night: false}));-- changeColorScheme(COLOR_SCHEME_LIGHT);- }- }}- activeOpacity={opacity}- style={{- width: '100%',- marginHorizontal: 0,- paddingBottom: 20,- paddingTop: 0,- flexDirection: 'row',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <Text- style={{- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- textAlignVertical: 'center',- color: colors.pri,- }}>- Font scaling- </Text>-- <View- style={{- borderBottomWidth: 1,- borderColor: colors.nav,- paddingVertical: 1,- paddingHorizontal: 5,- }}>- <Text- style={{- fontSize: SIZE.xs,- fontFamily: WEIGHT.regular,- textAlignVertical: 'center',- color: colors.pri,- }}>- 1.0x- </Text>- </View>- </TouchableOpacity>-<Textstyle={{fontSize: SIZE.xs,@@ -318,55 +271,56 @@ export const Settings = ({navigation}) => {Logged in as:</Text>- <View- style={{- justifyContent: 'space-between',- alignItems: 'center',- alignSelf: 'center',- flexDirection: 'row',- width: '100%',- paddingVertical: pv,- marginBottom: pv + 5,- marginTop: pv,- backgroundColor: colors.accent,- borderRadius: 5,- padding: 5,- }}>+ {user ? (<Viewstyle={{- flexDirection: 'row',- justifyContent: 'center',+ justifyContent: 'space-between',alignItems: 'center',- }}>- <Icon size={SIZE.lg} color="white" name="account-outline" />- <Text- style={{- color: 'white',- marginLeft: 5,- fontFamily: WEIGHT.regular,- fontSize: SIZE.sm,- }}>- {user.username}- </Text>- </View>-- <View- style={{+ alignSelf: 'center',+ flexDirection: 'row',+ width: '100%',+ paddingVertical: pv,+ marginBottom: pv + 5,+ marginTop: pv,+ backgroundColor: colors.accent,borderRadius: 5,padding: 5,- paddingVertical: 2.5,- backgroundColor: 'white',}}>- <Text+ <Viewstyle={{- color: colors.accent,- fontFamily: WEIGHT.regular,- fontSize: SIZE.xs,+ flexDirection: 'row',+ justifyContent: 'center',+ alignItems: 'center',}}>- Pro- </Text>+ <Icon size={SIZE.lg} color="white" name="account-outline" />+ <Text+ style={{+ color: 'white',+ marginLeft: 5,+ fontFamily: WEIGHT.regular,+ fontSize: SIZE.sm,+ }}>+ {user.username}+ </Text>+ </View>{' '}+ <View+ style={{+ borderRadius: 5,+ padding: 5,+ paddingVertical: 2.5,+ backgroundColor: 'white',+ }}>+ <Text+ style={{+ color: colors.accent,+ fontFamily: WEIGHT.regular,+ fontSize: SIZE.xs,+ }}>+ Pro+ </Text>+ </View></View>- </View>+ ) : null}{[{