π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Palette var
Manav Rathi8560304b1dc4
diff --git a/web/packages/base/components/utils/mui-theme.d.ts b/web/packages/base/components/utils/mui-theme.d.tsindex 7fd7106237..9522b03d73 100644--- a/web/packages/base/components/utils/mui-theme.d.ts+++ b/web/packages/base/components/utils/mui-theme.d.ts@@ -49,16 +49,6 @@ declare module "@mui/material/styles" {colors?: ThemeColorsOptions;}- interface Palette {- accent: PaletteColor;- critical: PaletteColor;- }-- interface PaletteOptions {- accent?: PaletteColorOptions;- critical?: PaletteColorOptions;- }-interface TypeText {base: string;muted: string;@@ -168,17 +158,40 @@ declare module "@mui/material/styles" {faintPressed: string;};- interface Shadows {- float: Shadow[];- menu: Shadow[];- button: Shadow[];+ /**+ * MUI as of v6 does not allow customizing the shadows easily. This is due+ * for change: https://github.com/mui/material-ui/issues/44291.+ *+ * Meanwhile use a custom variable. Since it is specific to the color+ * scheme, keep it inside the palette.+ */+ interface BoxShadow {+ /**+ * Drop shadow for "big" floating elements like {@link Dialog}.+ */+ float: string;+ /** Currently unused. */+ menu: string;+ /** Currently unused. */+ button: string;+ }+}++// Add new tokens to the Palette.+//+// https://mui.com/material-ui/customization/css-theme-variables/usage/#adding-new-theme-tokens++declare module "@mui/material/styles" {+ interface Palette {+ accent: PaletteColor;+ critical: PaletteColor;+ boxShadow: BoxShadow;}- interface Shadow {- x: number;- y: number;- blur: number;- color: string;+ interface PaletteOptions {+ accent?: PaletteColorOptions;+ critical?: PaletteColorOptions;+ boxShadow?: BoxShadow;}}diff --git a/web/packages/base/components/utils/theme.ts b/web/packages/base/components/utils/theme.tsindex 7ab404e361..3ef3c644df 100644--- a/web/packages/base/components/utils/theme.ts+++ b/web/packages/base/components/utils/theme.ts@@ -24,7 +24,7 @@ export const getTheme = () => {const colors = getColors(themeColor, colorAccentType);const palette = getPallette(themeColor, colors);- const components = getComponents(colors, typography);+ const components = getComponents(colors, palette, typography);return createTheme({colors,palette,@@ -121,6 +121,9 @@ export type ColorAccentType = "auth" | "photos";** - Custom colors (even if they're not PaletteColors) go within the palette.*+ * - Non-color tokens that depend on the color scheme (e.g. drop shadows) also+ * go within the palette so that they can be made color scheme specific.+ ** - All other custom variables remain within the top level theme.*/const getColors = (@@ -216,22 +219,14 @@ const lightThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {faint: "rgba(0, 0, 0, 0.12)",},- /*- // Light- shadows2L: {+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore+ boxShadow: {float: "0px 0px 10px rgba(0, 0, 0, 0.25)",menu: "0px 0px 6px rgba(0, 0, 0, 0.16), 0px 3px 6px rgba(0, 0, 0, 0.12)",button: "0px 4px 4px rgba(0, 0, 0, 0.25)",},- // Dark- shadows2D: {- float: "0px 2px 12px rgba(0, 0, 0, 0.75)",- menu: "0px 0px 6px rgba(0, 0, 0, 0.50), 0px 3px 6px rgba(0, 0, 0, 0.25)",- button: "0px 4px 4px rgba(0, 0, 0, 0.75)",- },- */-shadows: {float: [{ x: 0, y: 0, blur: 10, color: "rgba(0, 0, 0, 0.25)" }],menu: [@@ -288,6 +283,14 @@ const darkThemeColors: Omit<ThemeColorsOptions, keyof FixedColors> = {faint: "rgba(255,255,255,0.16)",},+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore+ boxShadow: {+ float: "0px 2px 12px rgba(0, 0, 0, 0.75)",+ menu: "0px 0px 6px rgba(0, 0, 0, 0.50), 0px 3px 6px rgba(0, 0, 0, 0.25)",+ button: "0px 4px 4px rgba(0, 0, 0, 0.75)",+ },+shadows: {float: [{@@ -384,6 +387,9 @@ const getPalletteOptions = (faint: colors.text?.faint,},divider: colors.stroke?.faint,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore+ boxShadow: colors.boxShadow,};};@@ -480,6 +486,7 @@ const typography: TypographyOptions = {const getComponents = (colors: ThemeColorsOptions,+ palette: PaletteOptions,typography: TypographyOptions,): Components => ({MuiCssBaseline: {@@ -536,7 +543,8 @@ const getComponents = (backgroundColor: colors.backdrop?.faint,},"& .MuiDialog-paper": {- filter: getDropShadowStyle(colors.shadows?.float),+ boxShadow: palette.boxShadow?.float,+ // filter: getDropShadowStyle(colors.shadows?.float),},// Reset the MUI default paddings to 16px everywhere.//