Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix colored notes ui

ammarahm-ede01a994e21ce
diff --git a/apps/mobile/src/components/SimpleList/announcement.js b/apps/mobile/src/components/SimpleList/announcement.js
index e79c888bf..ad49cfebc 100644
--- a/apps/mobile/src/components/SimpleList/announcement.js
+++ b/apps/mobile/src/components/SimpleList/announcement.js
@@ -7,6 +7,7 @@ import {
useSelectionStore
} from '../../provider/stores';
import {eSendEvent} from '../../services/EventManager';
+import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';
import {eOpenPremiumDialog, eOpenProgressDialog} from '../../utils/Events';
import {openLinkInBrowser} from '../../utils/functions';
import {SIZE} from '../../utils/SizeUtils';
@@ -16,7 +17,7 @@ import Seperator from '../Seperator';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-export const Announcement = () => {
+export const Announcement = ({color}) => {
const [state] = useTracked();
const colors = state.colors;
const announcements = useMessageStore(state => state.announcements);
@@ -64,9 +65,17 @@ export const Announcement = () => {
<Button
title={'Announcement'}
fontSize={12}
- type="shade"
height={null}
icon="bullhorn"
+ style={{
+ backgroundColor: color
+ ? RGB_Linear_Shade(
+ colors.night ? 0.04 : -0.04,
+ hexToRGBA(color, 0.12)
+ )
+ : colors.shade
+ }}
+ buttonType={{text: color || colors.accent}}
style={{
paddingVertical: 4
}}
@@ -126,6 +135,30 @@ export const Announcement = () => {
type={index === 0 ? 'accent' : 'shade'}
title={item.title}
fontSize={SIZE.md}
+ buttonType={{
+ color: color
+ ? index === 0
+ ? RGB_Linear_Shade(
+ colors.night ? 0.04 : -0.04,
+ hexToRGBA(color, 0.12)
+ )
+ : color
+ : index === 0
+ ? colors.accent
+ : colors.shade,
+ text:
+ index !== 0
+ ? color
+ ? color
+ : colors.accent
+ : colors.light,
+ selected: color
+ ? color
+ : index === 0
+ ? colors.accent
+ : colors.shade,
+ opacity: 0.12
+ }}
onPress={async () => {
if (item.type === 'link') {
try {
diff --git a/apps/mobile/src/components/SimpleList/empty.js b/apps/mobile/src/components/SimpleList/empty.js
index 21a2786a9..512284350 100644
--- a/apps/mobile/src/components/SimpleList/empty.js
+++ b/apps/mobile/src/components/SimpleList/empty.js
@@ -42,7 +42,7 @@ export const Empty = ({
}}>
<Placeholder
color={
- COLORS_NOTE[headerProps.heading.toLowerCase()] || colors.accent
+ COLORS_NOTE[headerProps.color] || colors.accent
}
w={normalize(150)}
h={normalize(150)}
@@ -68,17 +68,15 @@ export const Empty = ({
fontSize={SIZE.md}
accentColor="bg"
accentText={
- COLORS_NOTE[headerProps?.heading?.toLowerCase()]
- ? headerProps.heading?.toLowerCase()
+ COLORS_NOTE[headerProps.color]
+ ? headerProps.color
: 'accent'
}
/>
) : loading ? (
<ActivityIndicator
color={
- COLORS_NOTE[headerProps?.heading?.toLowerCase()]
- ? COLORS_NOTE[headerProps?.heading?.toLowerCase()]
- : colors.accent
+ COLORS_NOTE[headerProps.color] || colors.accent
}
/>
) : null}
diff --git a/apps/mobile/src/components/SimpleList/header.js b/apps/mobile/src/components/SimpleList/header.js
index c49bff451..dd8429337 100644
--- a/apps/mobile/src/components/SimpleList/header.js
+++ b/apps/mobile/src/components/SimpleList/header.js
@@ -41,7 +41,7 @@ export const Header = React.memo(
alignItems: 'center'
}}>
{messageCard && (
- <Card color={COLORS_NOTE[title.toLowerCase()] || colors.accent} />
+ <Card color={COLORS_NOTE[color] || colors.accent} />
)}
</View>
@@ -57,8 +57,8 @@ export const Header = React.memo(
width: '100%',
zIndex: 10,
justifyContent: 'flex-end',
- backgroundColor: COLORS_NOTE[title.toLowerCase()]
- ? hexToRGBA(COLORS_NOTE[title.toLowerCase()], 0.15)
+ backgroundColor: COLORS_NOTE[color]
+ ? hexToRGBA(COLORS_NOTE[color], 0.15)
: color || colors.shade
}}>
<View
@@ -69,7 +69,7 @@ export const Header = React.memo(
position: 'absolute'
}}>
<Placeholder
- color={COLORS_NOTE[title.toLowerCase()] || colors.accent}
+ color={COLORS_NOTE[color] || colors.accent}
w={normalize(150)}
h={normalize(150)}
type={screen === 'Favorites' ? 'favorites' : type}
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index 33b151a78..550f19caf 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -68,6 +68,7 @@ const SimpleList = ({
<SectionHeader
item={item}
index={index}
+ color={headerProps.color}
title={headerProps.heading}
type={screen === 'Notes' ? 'home' : type}
/>
@@ -149,6 +150,7 @@ const SimpleList = ({
paragraph={headerProps.paragraph}
onPress={headerProps.onPress}
icon={headerProps.icon}
+ color={headerProps.color}
type={type}
screen={screen}
/>
diff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.js
index 356b53c5e..aa639ecde 100644
--- a/apps/mobile/src/components/SimpleList/sectionheader.js
+++ b/apps/mobile/src/components/SimpleList/sectionheader.js
@@ -17,7 +17,7 @@ import {ActionIcon} from '../ActionIcon';
import {Button} from '../Button';
import Heading from '../Typography/Heading';
-export const SectionHeader = ({item, index, type, title}) => {
+export const SectionHeader = ({item, index, type, title,color}) => {
const [state] = useTracked();
const {colors} = state;
const {fontScale} = useWindowDimensions();
@@ -28,7 +28,6 @@ export const SectionHeader = ({item, index, type, title}) => {
key => SORT[key] === groupOptions.groupBy
);
- const color = COLORS_NOTE[title.toLowerCase()] || colors.accent;
const settings = useSettingStore(state => state.settings);
const listMode =
type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;
@@ -73,7 +72,7 @@ export const SectionHeader = ({item, index, type, title}) => {
justifyContent: 'center'
}}>
<Heading
- color={color}
+ color={COLORS_NOTE[color] || colors.accent }
size={SIZE.sm}
style={{
minWidth: 60,