π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Inline
Manav Rathi33fc86cff75d
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsxindex 2c90684450..25008063dc 100644--- a/web/apps/accounts/src/pages/_app.tsx+++ b/web/apps/accounts/src/pages/_app.tsx@@ -5,7 +5,6 @@ import { appTitle, type AppName, type BaseAppContextT } from "@/next/types/app";import { ensure } from "@/utils/ensure";import { PAGES } from "@ente/accounts/constants/pages";import { accountLogout } from "@ente/accounts/services/logout";-import { APPS } from "@ente/shared/apps/constants";import { Overlay } from "@ente/shared/components/Container";import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";@@ -81,7 +80,7 @@ export default function App({ Component, pageProps }: AppProps) {const closeDialogBoxV2 = () => setDialogBoxV2View(false);- const theme = getTheme(themeColor, APPS.PHOTOS);+ const theme = getTheme(themeColor, "photos");const logout = () => {void accountLogout().then(() => router.push(PAGES.ROOT));diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsxindex d403df1d28..50397b63ed 100644--- a/web/apps/auth/src/pages/_app.tsx+++ b/web/apps/auth/src/pages/_app.tsx@@ -12,7 +12,6 @@ import {} from "@/next/types/app";import { ensure } from "@/utils/ensure";import { accountLogout } from "@ente/accounts/services/logout";-import { APPS } from "@ente/shared/apps/constants";import { Overlay } from "@ente/shared/components/Container";import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";@@ -160,7 +159,7 @@ export default function App({ Component, pageProps }: AppProps) {<><CustomHead {...{ title }} />- <ThemeProvider theme={getTheme(themeColor, APPS.AUTH)}>+ <ThemeProvider theme={getTheme(themeColor, "auth")}><CssBaseline enableColorScheme />{showNavbar && <AppNavbar isMobile={isMobile} />}<MessageContainer>diff --git a/web/apps/cast/src/pages/_app.tsx b/web/apps/cast/src/pages/_app.tsxindex 939f2a59da..6428bed552 100644--- a/web/apps/cast/src/pages/_app.tsx+++ b/web/apps/cast/src/pages/_app.tsx@@ -2,7 +2,6 @@ import { CustomHead } from "@/next/components/Head";import { disableDiskLogs } from "@/next/log";import { logUnhandledErrorsAndRejections } from "@/next/log-web";import { appTitle } from "@/next/types/app";-import { APPS } from "@ente/shared/apps/constants";import { getTheme } from "@ente/shared/themes";import { THEME_COLOR } from "@ente/shared/themes/constants";import { CssBaseline, ThemeProvider } from "@mui/material";@@ -22,7 +21,7 @@ export default function App({ Component, pageProps }: AppProps) {<><CustomHead title={appTitle["photos"]} />- <ThemeProvider theme={getTheme(THEME_COLOR.DARK, APPS.PHOTOS)}>+ <ThemeProvider theme={getTheme(THEME_COLOR.DARK, "photos")}><CssBaseline enableColorScheme /><Component {...pageProps} /></ThemeProvider>diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex 8b2bf51a4d..406136948c 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -14,7 +14,6 @@ import {} from "@/next/types/app";import { AppUpdate } from "@/next/types/ipc";import { ensure } from "@/utils/ensure";-import { APPS } from "@ente/shared/apps/constants";import { Overlay } from "@ente/shared/components/Container";import DialogBox from "@ente/shared/components/DialogBox";import {@@ -370,7 +369,7 @@ export default function App({ Component, pageProps }: AppProps) {<><CustomHead {...{ title }} />- <ThemeProvider theme={getTheme(themeColor, APPS.PHOTOS)}>+ <ThemeProvider theme={getTheme(themeColor, "photos")}><CssBaseline enableColorScheme />{showNavbar && <AppNavbar isMobile={isMobile} />}<MessageContainer>diff --git a/web/packages/shared/themes/colors.ts b/web/packages/shared/themes/colors.tsnew file mode 100644index 0000000000..92c2ed8ef9--- /dev/null+++ b/web/packages/shared/themes/colors.ts@@ -0,0 +1,247 @@+import type { FixedColors, ThemeColorsOptions } from "@mui/material";+import { THEME_COLOR } from "./constants";++export type ColorAccentType = "auth" | "photos";++export const getColors = (+ themeColor: THEME_COLOR,+ accentType: ColorAccentType,+): ThemeColorsOptions => {+ switch (themeColor) {+ case THEME_COLOR.LIGHT:+ return { ...fixedColors(accentType), ...lightThemeColors };+ default:+ return { ...fixedColors(accentType), ...darkThemeColors };+ }+};++const fixedColors = (+ accentType: "auth" | "photos",+): Pick<ThemeColorsOptions, keyof FixedColors> => {+ switch (accentType) {+ case "auth":+ return {+ ...commonFixedColors,+ accent: authAccentColor,+ };+ default:+ return {+ ...commonFixedColors,+ accent: photosAccentColor,+ };+ }+};++const commonFixedColors: Partial<Pick<ThemeColorsOptions, keyof FixedColors>> =+ {+ accent: {+ A700: "#00B33C",+ A500: "#1DB954",+ A400: "#26CB5F",+ A300: "#01DE4D",+ },+ warning: {+ A500: "#FFC247",+ },+ danger: {+ A800: "#F53434",+ A700: "#EA3F3F",+ A500: "#FF6565",+ A400: "#FF6F6F",+ },+ blur: {+ base: 96,+ muted: 48,+ faint: 24,+ },++ white: { base: "#fff", muted: "rgba(255, 255, 255, 0.48)" },+ black: { base: "#000", muted: "rgba(0, 0, 0, 0.65)" },+ };++const authAccentColor = {+ A700: "rgb(164, 0, 182)",+ A500: "rgb(150, 13, 214)",+ A400: "rgb(122, 41, 193)",+ A300: "rgb(152, 77, 244)",+};++const photosAccentColor = {+ A700: "#00B33C",+ A500: "#1DB954",+ A400: "#26CB5F",+ A300: "#01DE4D",+};++const lightThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {+ background: {+ base: "#fff",+ elevated: "#fff",+ elevated2: "rgba(153, 153, 153, 0.04)",+ },+ backdrop: {+ base: "rgba(255, 255, 255, 0.92)",+ muted: "rgba(255, 255, 255, 0.75)",+ faint: "rgba(255, 255, 255, 0.30)",+ },+ text: {+ base: "#000",+ muted: "rgba(0, 0, 0, 0.60)",+ faint: "rgba(0, 0, 0, 0.50)",+ },+ fill: {+ base: "#000",+ muted: "rgba(0, 0, 0, 0.12)",+ faint: "rgba(0, 0, 0, 0.04)",+ basePressed: "rgba(0, 0, 0, 0.87))",+ faintPressed: "rgba(0, 0, 0, 0.08)",+ strong: "rgba(0, 0, 0, 0.24)",+ },+ stroke: {+ base: "#000",+ muted: "rgba(0, 0, 0, 0.24)",+ faint: "rgba(0, 0, 0, 0.12)",+ fainter: "rgba(0, 0, 0, 0.06)",+ },++ shadows: {+ float: [{ x: 0, y: 0, blur: 10, color: "rgba(0, 0, 0, 0.25)" }],+ menu: [+ {+ x: 0,+ y: 0,+ blur: 6,+ color: "rgba(0, 0, 0, 0.16)",+ },+ {+ x: 0,+ y: 3,+ blur: 6,+ color: "rgba(0, 0, 0, 0.12)",+ },+ ],+ button: [+ {+ x: 0,+ y: 4,+ blur: 4,+ color: "rgba(0, 0, 0, 0.25)",+ },+ ],+ },+ avatarColors: [+ "#76549A",+ "#DF7861",+ "#94B49F",+ "#87A2FB",+ "#C689C6",+ "#937DC2",+ "#325288",+ "#85B4E0",+ "#C1A3A3",+ "#E1A059",+ "#426165",+ "#6B77B2",+ "#957FEF",+ "#DD9DE2",+ "#82AB8B",+ "#9BBBE8",+ "#8FBEBE",+ "#8AC3A1",+ "#A8B0F2",+ "#B0C695",+ "#E99AAD",+ "#D18484",+ "#78B5A7",+ ],+};++const darkThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {+ background: {+ base: "#000000",+ elevated: "#1b1b1b",+ elevated2: "#252525",+ },+ backdrop: {+ base: "rgba(0, 0, 0, 0.90)",+ muted: "rgba(0, 0, 0, 0.65)",+ faint: "rgba(0, 0, 0,0.20)",+ },+ text: {+ base: "#fff",+ muted: "rgba(255, 255, 255, 0.70)",+ faint: "rgba(255, 255, 255, 0.50)",+ },+ fill: {+ base: "#fff",+ muted: "rgba(255, 255, 255, 0.16)",+ faint: "rgba(255, 255, 255, 0.12)",+ basePressed: "rgba(255, 255, 255, 0.90)",+ faintPressed: "rgba(255, 255, 255, 0.06)",+ strong: "rgba(255, 255, 255, 0.32)",+ },+ stroke: {+ base: "#ffffff",+ muted: "rgba(255,255,255,0.24)",+ faint: "rgba(255,255,255,0.16)",+ fainter: "rgba(255,255,255,0.08)",+ },++ shadows: {+ float: [+ {+ x: 0,+ y: 2,+ blur: 12,+ color: "rgba(0, 0, 0, 0.75)",+ },+ ],+ menu: [+ {+ x: 0,+ y: 0,+ blur: 6,+ color: "rgba(0, 0, 0, 0.50)",+ },+ {+ x: 0,+ y: 3,+ blur: 6,+ color: "rgba(0, 0, 0, 0.25)",+ },+ ],+ button: [+ {+ x: 0,+ y: 4,+ blur: 4,+ color: "rgba(0, 0, 0, 0.75)",+ },+ ],+ },+ avatarColors: [+ "#76549A",+ "#DF7861",+ "#94B49F",+ "#87A2FB",+ "#C689C6",+ "#937DC2",+ "#325288",+ "#85B4E0",+ "#C1A3A3",+ "#E1A059",+ "#426165",+ "#6B77B2",+ "#957FEF",+ "#DD9DE2",+ "#82AB8B",+ "#9BBBE8",+ "#8FBEBE",+ "#8AC3A1",+ "#A8B0F2",+ "#B0C695",+ "#E99AAD",+ "#D18484",+ "#78B5A7",+ ],+};diff --git a/web/packages/shared/themes/colors/dark.ts b/web/packages/shared/themes/colors/dark.tsdeleted file mode 100644index 3550c3be17..0000000000--- a/web/packages/shared/themes/colors/dark.ts+++ /dev/null@@ -1,93 +0,0 @@-import type { FixedColors, ThemeColorsOptions } from "@mui/material";--const darkThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {- background: {- base: "#000000",- elevated: "#1b1b1b",- elevated2: "#252525",- },- backdrop: {- base: "rgba(0, 0, 0, 0.90)",- muted: "rgba(0, 0, 0, 0.65)",- faint: "rgba(0, 0, 0,0.20)",- },- text: {- base: "#fff",- muted: "rgba(255, 255, 255, 0.70)",- faint: "rgba(255, 255, 255, 0.50)",- },- fill: {- base: "#fff",- muted: "rgba(255, 255, 255, 0.16)",- faint: "rgba(255, 255, 255, 0.12)",- basePressed: "rgba(255, 255, 255, 0.90)",- faintPressed: "rgba(255, 255, 255, 0.06)",- strong: "rgba(255, 255, 255, 0.32)",- },- stroke: {- base: "#ffffff",- muted: "rgba(255,255,255,0.24)",- faint: "rgba(255,255,255,0.16)",- fainter: "rgba(255,255,255,0.08)",- },-- shadows: {- float: [- {- x: 0,- y: 2,- blur: 12,- color: "rgba(0, 0, 0, 0.75)",- },- ],- menu: [- {- x: 0,- y: 0,- blur: 6,- color: "rgba(0, 0, 0, 0.50)",- },- {- x: 0,- y: 3,- blur: 6,- color: "rgba(0, 0, 0, 0.25)",- },- ],- button: [- {- x: 0,- y: 4,- blur: 4,- color: "rgba(0, 0, 0, 0.75)",- },- ],- },- avatarColors: [- "#76549A",- "#DF7861",- "#94B49F",- "#87A2FB",- "#C689C6",- "#937DC2",- "#325288",- "#85B4E0",- "#C1A3A3",- "#E1A059",- "#426165",- "#6B77B2",- "#957FEF",- "#DD9DE2",- "#82AB8B",- "#9BBBE8",- "#8FBEBE",- "#8AC3A1",- "#A8B0F2",- "#B0C695",- "#E99AAD",- "#D18484",- "#78B5A7",- ],-};--export default darkThemeColors;diff --git a/web/packages/shared/themes/colors/fixed.ts b/web/packages/shared/themes/colors/fixed.tsdeleted file mode 100644index 0433821674..0000000000--- a/web/packages/shared/themes/colors/fixed.ts+++ /dev/null@@ -1,60 +0,0 @@-import { APPS } from "@ente/shared/apps/constants";-import type { FixedColors, ThemeColorsOptions } from "@mui/material";--export const getFixesColors = (- appName: APPS,-): Pick<ThemeColorsOptions, keyof FixedColors> => {- switch (appName) {- case APPS.AUTH:- return {- ...commonFixedColors,- accent: authAccentColor,- };- default:- return {- ...commonFixedColors,- accent: photosAccentColor,- };- }-};--const commonFixedColors: Partial<Pick<ThemeColorsOptions, keyof FixedColors>> =- {- accent: {- A700: "#00B33C",- A500: "#1DB954",- A400: "#26CB5F",- A300: "#01DE4D",- },- warning: {- A500: "#FFC247",- },- danger: {- A800: "#F53434",- A700: "#EA3F3F",- A500: "#FF6565",- A400: "#FF6F6F",- },- blur: {- base: 96,- muted: 48,- faint: 24,- },-- white: { base: "#fff", muted: "rgba(255, 255, 255, 0.48)" },- black: { base: "#000", muted: "rgba(0, 0, 0, 0.65)" },- };--const authAccentColor = {- A700: "rgb(164, 0, 182)",- A500: "rgb(150, 13, 214)",- A400: "rgb(122, 41, 193)",- A300: "rgb(152, 77, 244)",-};--const photosAccentColor = {- A700: "#00B33C",- A500: "#1DB954",- A400: "#26CB5F",- A300: "#01DE4D",-};diff --git a/web/packages/shared/themes/colors/index.ts b/web/packages/shared/themes/colors/index.tsdeleted file mode 100644index 1bc874ae12..0000000000--- a/web/packages/shared/themes/colors/index.ts+++ /dev/null@@ -1,18 +0,0 @@-import { APPS } from "@ente/shared/apps/constants";-import type { ThemeColorsOptions } from "@mui/material";-import { THEME_COLOR } from "../constants";-import darkThemeColors from "./dark";-import { getFixesColors } from "./fixed";-import lightThemeColors from "./light";--export const getColors = (- themeColor: THEME_COLOR,- appName: APPS,-): ThemeColorsOptions => {- switch (themeColor) {- case THEME_COLOR.LIGHT:- return { ...getFixesColors(appName), ...lightThemeColors };- default:- return { ...getFixesColors(appName), ...darkThemeColors };- }-};diff --git a/web/packages/shared/themes/colors/light.ts b/web/packages/shared/themes/colors/light.tsdeleted file mode 100644index a354ee61e8..0000000000--- a/web/packages/shared/themes/colors/light.ts+++ /dev/null@@ -1,86 +0,0 @@-import type { FixedColors, ThemeColorsOptions } from "@mui/material";--const lightThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {- background: {- base: "#fff",- elevated: "#fff",- elevated2: "rgba(153, 153, 153, 0.04)",- },- backdrop: {- base: "rgba(255, 255, 255, 0.92)",- muted: "rgba(255, 255, 255, 0.75)",- faint: "rgba(255, 255, 255, 0.30)",- },- text: {- base: "#000",- muted: "rgba(0, 0, 0, 0.60)",- faint: "rgba(0, 0, 0, 0.50)",- },- fill: {- base: "#000",- muted: "rgba(0, 0, 0, 0.12)",- faint: "rgba(0, 0, 0, 0.04)",- basePressed: "rgba(0, 0, 0, 0.87))",- faintPressed: "rgba(0, 0, 0, 0.08)",- strong: "rgba(0, 0, 0, 0.24)",- },- stroke: {- base: "#000",- muted: "rgba(0, 0, 0, 0.24)",- faint: "rgba(0, 0, 0, 0.12)",- fainter: "rgba(0, 0, 0, 0.06)",- },-- shadows: {- float: [{ x: 0, y: 0, blur: 10, color: "rgba(0, 0, 0, 0.25)" }],- menu: [- {- x: 0,- y: 0,- blur: 6,- color: "rgba(0, 0, 0, 0.16)",- },- {- x: 0,- y: 3,- blur: 6,- color: "rgba(0, 0, 0, 0.12)",- },- ],- button: [- {- x: 0,- y: 4,- blur: 4,- color: "rgba(0, 0, 0, 0.25)",- },- ],- },- avatarColors: [- "#76549A",- "#DF7861",- "#94B49F",- "#87A2FB",- "#C689C6",- "#937DC2",- "#325288",- "#85B4E0",- "#C1A3A3",- "#E1A059",- "#426165",- "#6B77B2",- "#957FEF",- "#DD9DE2",- "#82AB8B",- "#9BBBE8",- "#8FBEBE",- "#8AC3A1",- "#A8B0F2",- "#B0C695",- "#E99AAD",- "#D18484",- "#78B5A7",- ],-};--export default lightThemeColors;diff --git a/web/packages/shared/themes/index.ts b/web/packages/shared/themes/index.tsindex bedaa706e0..380da0f82c 100644--- a/web/packages/shared/themes/index.ts+++ b/web/packages/shared/themes/index.ts@@ -1,13 +1,15 @@-import { APPS } from "@ente/shared/apps/constants";import { createTheme } from "@mui/material";-import { getColors } from "./colors";+import { getColors, type ColorAccentType } from "./colors";import { getComponents } from "./components";import { THEME_COLOR } from "./constants";import { getPallette } from "./palette";import { typography } from "./typography";-export const getTheme = (themeColor: THEME_COLOR, appName: APPS) => {- const colors = getColors(themeColor, appName);+export const getTheme = (+ themeColor: THEME_COLOR,+ colorAccentType: ColorAccentType,+) => {+ const colors = getColors(themeColor, colorAccentType);const palette = getPallette(themeColor, colors);const components = getComponents(colors, typography);const theme = createTheme({diff --git a/web/packages/shared/themes/palette/index.tsx b/web/packages/shared/themes/palette.tsxsimilarity index 97%rename from web/packages/shared/themes/palette/index.tsxrename to web/packages/shared/themes/palette.tsxindex 81d6cd5988..004d06b4cb 100644--- a/web/packages/shared/themes/palette/index.tsx+++ b/web/packages/shared/themes/palette.tsx@@ -1,6 +1,6 @@import { ensure } from "@/utils/ensure";import type { PaletteOptions, ThemeColorsOptions } from "@mui/material";-import { THEME_COLOR } from "../constants";+import { THEME_COLOR } from "./constants";export const getPallette = (themeColor: THEME_COLOR,