mui-theme.d.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. import { PaletteColor, PaletteColorOptions } from "@mui/material";
  2. import React from "react";
  3. declare module "@mui/material/styles" {
  4. interface Theme {
  5. colors: ThemeColors;
  6. }
  7. interface ThemeOptions {
  8. colors?: ThemeColorsOptions;
  9. }
  10. interface Palette {
  11. accent: PaletteColor;
  12. critical: PaletteColor;
  13. }
  14. interface PaletteOptions {
  15. accent?: PaletteColorOptions;
  16. critical?: PaletteColorOptions;
  17. }
  18. interface TypeText {
  19. base: string;
  20. muted: string;
  21. faint: string;
  22. }
  23. interface TypographyVariants {
  24. large: React.CSSProperties;
  25. body: React.CSSProperties;
  26. small: React.CSSProperties;
  27. mini: React.CSSProperties;
  28. tiny: React.CSSProperties;
  29. }
  30. interface TypographyVariantsOptions {
  31. large?: React.CSSProperties;
  32. body?: React.CSSProperties;
  33. small?: React.CSSProperties;
  34. mini?: React.CSSProperties;
  35. tiny?: React.CSSProperties;
  36. }
  37. }
  38. declare module "@mui/material/Typography" {
  39. interface TypographyPropsVariantOverrides {
  40. large: true;
  41. body: true;
  42. small: true;
  43. mini: true;
  44. tiny: true;
  45. h4: false;
  46. h5: false;
  47. h6: false;
  48. subtitle1: false;
  49. subtitle2: false;
  50. body1: false;
  51. body2: false;
  52. caption: false;
  53. button: false;
  54. overline: false;
  55. }
  56. }
  57. declare module "@mui/material/Button" {
  58. interface ButtonPropsColorOverrides {
  59. accent: true;
  60. critical: true;
  61. error: false;
  62. success: false;
  63. info: false;
  64. warning: false;
  65. }
  66. }
  67. declare module "@mui/material/Checkbox" {
  68. interface CheckboxPropsColorOverrides {
  69. accent: true;
  70. critical: true;
  71. }
  72. }
  73. declare module "@mui/material/Switch" {
  74. interface SwitchPropsColorOverrides {
  75. accent: true;
  76. }
  77. }
  78. declare module "@mui/material/SvgIcon" {
  79. interface SvgIconPropsColorOverrides {
  80. accent: true;
  81. }
  82. }
  83. declare module "@mui/material/CircularProgress" {
  84. interface CircularProgressPropsColorOverrides {
  85. accent: true;
  86. }
  87. }
  88. // =================================================
  89. // Custom Interfaces
  90. // =================================================
  91. declare module "@mui/material/styles" {
  92. interface ThemeColors {
  93. background: BackgroundType;
  94. backdrop: Strength;
  95. text: Strength;
  96. fill: FillStrength;
  97. stroke: StrokeStrength;
  98. shadows: Shadows;
  99. accent: ColorStrength;
  100. warning: ColorStrength;
  101. danger: ColorStrength;
  102. blur: BlurStrength;
  103. white: Omit<Strength, "faint">;
  104. black: Omit<Strength, "faint">;
  105. avatarColors: AvatarColors;
  106. }
  107. interface ThemeColorsOptions {
  108. background?: Partial<BackgroundType>;
  109. backdrop?: Partial<Strength>;
  110. text?: Partial<Strength>;
  111. fill?: Partial<FillStrength>;
  112. stroke?: Partial<StrokeStrength>;
  113. shadows?: Partial<Shadows>;
  114. accent?: Partial<ColorStrength>;
  115. warning?: Partial<ColorStrength>;
  116. danger?: Partial<ColorStrength>;
  117. blur?: Partial<BlurStrength>;
  118. white?: Partial<Omit<Strength, "faint">>;
  119. black?: Partial<Omit<Strength, "faint">>;
  120. avatarColors?: Partial<AvatarColors>;
  121. }
  122. interface ColorStrength {
  123. A800: string;
  124. A700: string;
  125. A500: string;
  126. A400: string;
  127. A300: string;
  128. }
  129. interface FixedColors {
  130. accent: string;
  131. warning: string;
  132. danger: string;
  133. blur: number;
  134. white: string;
  135. black: string;
  136. }
  137. interface BackgroundType {
  138. base: string;
  139. elevated: string;
  140. elevated2: string;
  141. }
  142. interface Strength {
  143. base: string;
  144. muted: string;
  145. faint: string;
  146. }
  147. type FillStrength = Strength & StrengthFillPressed & StrengthFillStrong;
  148. interface StrengthFillPressed {
  149. basePressed: string;
  150. faintPressed: string;
  151. }
  152. interface StrengthFillStrong {
  153. strong: string;
  154. }
  155. type StrokeStrength = Strength & StrengthExtras;
  156. interface StrengthExtras {
  157. fainter: string;
  158. }
  159. interface Shadows {
  160. float: Shadow[];
  161. menu: Shadow[];
  162. button: Shadow[];
  163. }
  164. interface Shadow {
  165. x: number;
  166. y: number;
  167. blur: number;
  168. color: string;
  169. }
  170. interface BlurStrength {
  171. base: number;
  172. muted: number;
  173. faint: number;
  174. }
  175. type AvatarColors = Array<string>;
  176. }
  177. export {};