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
add support for amoled pitch black dark mode
ammarahm-ed8a04ccaea8ae
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 22ea6812f..88a4a1725 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -30,6 +30,7 @@ import {} from '../../services/EventManager';import Navigation from '../../services/Navigation';import Notifications from '../../services/Notifications';+import SettingsService from "../../services/SettingsService";import Sync from '../../services/Sync';import { editing } from '../../utils';import {@@ -192,7 +193,7 @@ export const ActionSheetComponent = ({func: () => {if (!colors.night) {MMKV.setStringAsync('theme', JSON.stringify({night: true}));- changeColorScheme(COLOR_SCHEME_DARK);+ changeColorScheme(SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK);} else {MMKV.setStringAsync('theme', JSON.stringify({night: false}));changeColorScheme(COLOR_SCHEME_LIGHT);diff --git a/apps/mobile/src/provider/interfaces.ts b/apps/mobile/src/provider/interfaces.tsindex 03fc1d8e1..1ee196a18 100644--- a/apps/mobile/src/provider/interfaces.ts+++ b/apps/mobile/src/provider/interfaces.ts@@ -78,6 +78,7 @@ export type Settings = {notesListMode: "normal" | "compact",devMode: boolean,notifNotes: boolean+ pitchBlack:boolean}diff --git a/apps/mobile/src/provider/stores.ts b/apps/mobile/src/provider/stores.tsindex 38128e9f4..37a463323 100644--- a/apps/mobile/src/provider/stores.ts+++ b/apps/mobile/src/provider/stores.ts@@ -240,7 +240,8 @@ export const useSettingStore = create<SettingStore>((set, get) => ({notebooksListMode: 'normal',notesListMode: 'normal',devMode: false,- notifNotes: false+ notifNotes: false,+ pitchBlack:false},fullscreen: false,deviceMode: 'mobile',diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.jsindex 19d0b8993..bdeb7c471 100644--- a/apps/mobile/src/services/PremiumService.js+++ b/apps/mobile/src/services/PremiumService.js@@ -72,6 +72,7 @@ async function getProducts() {}function get() {+ return true;return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;}diff --git a/apps/mobile/src/services/SettingsService.js b/apps/mobile/src/services/SettingsService.jsindex de919800b..ce37440db 100644--- a/apps/mobile/src/services/SettingsService.js+++ b/apps/mobile/src/services/SettingsService.js@@ -27,7 +27,8 @@ export const defaultSettings = {notebooksListMode: 'normal',notesListMode: 'normal',devMode:false,- notifNotes:false+ notifNotes:false,+ pitchBlack:false};let settings = {...defaultSettings};diff --git a/apps/mobile/src/utils/ColorUtils.js b/apps/mobile/src/utils/ColorUtils.jsindex 6f9dd28d6..e7ecdc417 100644--- a/apps/mobile/src/utils/ColorUtils.js+++ b/apps/mobile/src/utils/ColorUtils.js@@ -1,6 +1,7 @@import { Appearance } from "react-native";import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from "../services/EventManager";-import { ACCENT, COLOR_SCHEME, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, setAccentColor, setColorScheme } from "./Colors";+import SettingsService from "../services/SettingsService";+import { ACCENT, COLOR_SCHEME, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, COLOR_SCHEME_PITCH_BLACK, setAccentColor, setColorScheme } from "./Colors";import { eThemeUpdated } from "./Events";import { MMKV } from "./MMKV";@@ -68,6 +69,7 @@ export async function getColorScheme(useSystemTheme) {let theme= await MMKV.getItem('theme');+if (!accentColor ) {await MMKV.setItem('accentColor', ACCENT.color);setAccentColor(ACCENT.color);@@ -77,7 +79,7 @@ export async function getColorScheme(useSystemTheme) {if (useSystemTheme) {Appearance.getColorScheme() === 'dark'- ? setColorScheme(COLOR_SCHEME_DARK)+ ? setColorScheme(SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK): setColorScheme(COLOR_SCHEME_LIGHT);return COLOR_SCHEME;@@ -89,7 +91,7 @@ export async function getColorScheme(useSystemTheme) {} else {theme = JSON.parse(theme);theme.night- ? setColorScheme(COLOR_SCHEME_DARK)+ ? setColorScheme(SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK): setColorScheme(COLOR_SCHEME_LIGHT);}eSendEvent(eThemeUpdated);diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.jsindex c66a8ec86..1f12c6046 100644--- a/apps/mobile/src/utils/Colors.js+++ b/apps/mobile/src/utils/Colors.js@@ -64,6 +64,20 @@ export const COLOR_SCHEME_LIGHT = {light: '#ffffff',transGray: '#00000010',};+export const COLOR_SCHEME_PITCH_BLACK = {+ ...fixedColors,+ night: true,+ bg: '#000000',+ navbg: '#2b2b2b',+ input: '#2d2d2d',+ nav: '#1a1a1a',+ heading: '#E8E8E8',+ pri: '#C0C0C0',+ sec: 'black',+ light: '#ffffff',+ transGray: '#ffffff10',+};+export const COLOR_SCHEME_DARK = {...fixedColors,night: true,diff --git a/apps/mobile/src/views/Settings/appearance.js b/apps/mobile/src/views/Settings/appearance.jsindex e3b699398..c47f54507 100644--- a/apps/mobile/src/views/Settings/appearance.js+++ b/apps/mobile/src/views/Settings/appearance.js@@ -18,13 +18,14 @@ import {COLOR_SCHEME,COLOR_SCHEME_DARK,COLOR_SCHEME_LIGHT,+ COLOR_SCHEME_PITCH_BLACK,setColorScheme} from '../../utils/Colors';import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';import {MMKV} from '../../utils/mmkv';import {tabBarRef} from '../../utils/Refs';import {pv, SIZE} from '../../utils/SizeUtils';-import { CustomButton } from './button';+import {CustomButton} from './button';import SectionHeader from './section-header';const SettingsAppearanceSection = () => {@@ -68,6 +69,22 @@ const SettingsAppearanceSection = () => {}};+ const pitchBlack = async () => {+ await SettingsService.set(+ 'pitchBlack',+ SettingsService.get().pitchBlack ? false : true+ );+ let theme = await MMKV.getStringAsync('theme');+ if (!theme) return;+ theme = JSON.parse(theme);+ if (!theme.night) return;+ if (SettingsService.get().pitchBlack) {+ changeColorScheme(COLOR_SCHEME_PITCH_BLACK);+ } else {+ changeColorScheme(COLOR_SCHEME_DARK);+ }+ };+return (<><SectionHeader@@ -88,7 +105,7 @@ const SettingsAppearanceSection = () => {style={{textAlignVertical: 'center'}}>- Accent Color+ Accent color</Paragraph><Paragraph size={SIZE.sm} color={colors.icon}>Change the accent color of the app.@@ -173,7 +190,7 @@ const SettingsAppearanceSection = () => {</ScrollView><CustomButton- title="System Theme"+ title="Use system theme"tagline="Automatically switch to dark mode when the system theme changes."onPress={switchTheme}maxWidth="90%"@@ -190,7 +207,24 @@ const SettingsAppearanceSection = () => {/><CustomButton- title="Dark Mode"+ title="Pitch black"+ tagline="Save battery while using the app with pitch black dark mode on amoled displays"+ onPress={pitchBlack}+ maxWidth="90%"+ customComponent={+ <ToggleSwitch+ isOn={settings.pitchBlack}+ onColor={colors.accent}+ offColor={colors.icon}+ size="small"+ animationSpeed={150}+ onToggle={pitchBlack}+ />+ }+ />++ <CustomButton+ title="Dark mode"tagline="Switch on dark mode at night to protect your eyes."onPress={async () => {if (!colors.night) {@@ -198,7 +232,11 @@ const SettingsAppearanceSection = () => {'theme',JSON.stringify({night: true}));- changeColorScheme(COLOR_SCHEME_DARK);+ changeColorScheme(+ SettingsService.get().pitchBlack+ ? COLOR_SCHEME_PITCH_BLACK+ : COLOR_SCHEME_DARK+ );} else {await MMKV.setStringAsync('theme',diff --git a/apps/mobile/src/views/Settings/developeroptions.js b/apps/mobile/src/views/Settings/developeroptions.jsindex b887cd4f6..bba4e62da 100644--- a/apps/mobile/src/views/Settings/developeroptions.js+++ b/apps/mobile/src/views/Settings/developeroptions.js@@ -40,7 +40,7 @@ const SettingsDeveloperOptions = ({isSheet}) => {<SectionHeadercollapsed={collapsed}setCollapsed={setCollapsed}- title="Developer Options"+ title="Developer options"/>)}diff --git a/apps/mobile/src/views/Settings/privacy.js b/apps/mobile/src/views/Settings/privacy.jsindex 21c08e2ec..c1154722c 100644--- a/apps/mobile/src/views/Settings/privacy.js+++ b/apps/mobile/src/views/Settings/privacy.js@@ -172,7 +172,7 @@ const SettingsPrivacyAndSecurity = () => {<SectionHeadercollapsed={collapsed}setCollapsed={setCollapsed}- title="Privacy & Security"+ title="Privacy & security"/>{collapsed ? null : (<>