theme.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. import {css} from '@emotion/react';
  2. import color from 'color';
  3. import CHART_PALETTE from 'sentry/constants/chartPalette';
  4. import {DataCategory, Outcome} from 'sentry/types';
  5. /**
  6. * Exporting for use in Storybook only. Do not import this
  7. * anywhere else! Instead, use the theme prop or import useTheme.
  8. */
  9. export const lightColors = {
  10. black: '#1D1127',
  11. white: '#FFFFFF',
  12. surface100: '#FAF9FB',
  13. surface200: '#FFFFFF',
  14. surface300: '#FFFFFF',
  15. surface400: '#F5F3F7',
  16. gray500: '#2B2233',
  17. gray400: '#3E3446',
  18. gray300: '#80708F',
  19. gray200: '#DBD6E1',
  20. gray100: '#EBE6EF',
  21. /**
  22. * Alternative version of gray200 that's translucent.
  23. * Useful for borders on tooltips, popovers, and dialogs.
  24. */
  25. translucentGray200: 'rgba(58, 17, 95, 0.18)',
  26. translucentGray100: 'rgba(45, 0, 85, 0.1)',
  27. purple400: '#584AC0',
  28. purple300: '#6C5FC7',
  29. purple200: 'rgba(108, 95, 199, 0.5)',
  30. purple100: 'rgba(108, 95, 199, 0.08)',
  31. blue400: '#2562D4',
  32. blue300: '#3C74DD',
  33. blue200: 'rgba(60, 116, 221, 0.5)',
  34. blue100: 'rgba(60, 116, 221, 0.09)',
  35. green400: '#268D75',
  36. green300: '#2BA185',
  37. green200: 'rgba(43, 161, 133, 0.55)',
  38. green100: 'rgba(43, 161, 133, 0.13)',
  39. yellow400: '#E5A500',
  40. yellow300: '#F5B000',
  41. yellow200: 'rgba(245, 176, 0, 0.55)',
  42. yellow100: 'rgba(245, 176, 0, 0.08)',
  43. red400: '#F32F35',
  44. red300: '#F55459',
  45. red200: 'rgba(245, 84, 89, 0.5)',
  46. red100: 'rgba(245, 84, 89, 0.09)',
  47. pink400: '#E50675',
  48. pink300: '#F91A8A',
  49. pink200: 'rgba(249, 26, 138, 0.5)',
  50. pink100: 'rgba(249, 26, 138, 0.1)',
  51. };
  52. /**
  53. * Exporting for use in Storybook only. Do not import this
  54. * anywhere else! Instead, use the theme prop or import useTheme.
  55. */
  56. export const darkColors = {
  57. black: '#1D1127',
  58. white: '#FFFFFF',
  59. surface100: '#1A141F',
  60. surface200: '#241D2A',
  61. surface300: '#2C2433',
  62. surface400: '#362E3E',
  63. gray500: '#EBE6EF',
  64. gray400: '#D6D0DC',
  65. gray300: '#998DA5',
  66. gray200: '#43384C',
  67. gray100: '#342B3B',
  68. /**
  69. * Alternative version of gray200 that's translucent.
  70. * Useful for borders on tooltips, popovers, and dialogs.
  71. */
  72. translucentGray200: 'rgba(218, 184, 245, 0.18)',
  73. translucentGray100: 'rgba(208, 168, 240, 0.1)',
  74. purple400: '#6859CF',
  75. purple300: '#7669D3',
  76. purple200: 'rgba(108, 95, 199, 0.6)',
  77. purple100: 'rgba(118, 105, 211, 0.1)',
  78. blue400: '#4284FF',
  79. blue300: '#5C95FF',
  80. blue200: 'rgba(92, 149, 255, 0.4)',
  81. blue100: 'rgba(92, 149, 255, 0.1)',
  82. green400: '#26B593',
  83. green300: '#2AC8A3',
  84. green200: 'rgba(42, 200, 163, 0.4)',
  85. green100: 'rgba(42, 200, 163, 0.1)',
  86. yellow400: '#F5B000',
  87. yellow300: '#FFC227',
  88. yellow200: 'rgba(255, 194, 39, 0.35)',
  89. yellow100: 'rgba(255, 194, 39, 0.07)',
  90. red400: '#FA2E34',
  91. red300: '#FA4F54',
  92. red200: 'rgba(250, 79, 84, 0.4)',
  93. red100: 'rgba(250, 79, 84, 0.1)',
  94. pink400: '#C4317A',
  95. pink300: '#D1478C',
  96. pink200: 'rgba(209, 71, 140, 0.55)',
  97. pink100: 'rgba(209, 71, 140, 0.13)',
  98. };
  99. const lightShadows = {
  100. dropShadowLightest: '0 0 2px rgba(43, 34, 51, 0.04)',
  101. dropShadowLight: '0 1px 4px rgba(43, 34, 51, 0.04)',
  102. dropShadowHeavy: '0 4px 24px rgba(43, 34, 51, 0.12)',
  103. };
  104. const darkShadows = {
  105. dropShadowLightest: '0 0 2px rgba(10, 8, 12, 0.2)',
  106. dropShadowLight: '0 1px 4px rgba(10, 8, 12, 0.2)',
  107. dropShadowHeavy: '0 4px 24px rgba(10, 8, 12, 0.36)',
  108. };
  109. /**
  110. * Background used in the theme-color meta tag
  111. * The colors below are an approximation of the colors used in the sidebar (sidebarGradient).
  112. * Unfortunately the exact colors cannot be used, as the theme-color tag does not support linear-gradient()
  113. */
  114. const sidebarBackground = {
  115. light: '#2f1937',
  116. dark: '#181622',
  117. };
  118. type BaseColors = typeof lightColors;
  119. const generateAliases = (colors: BaseColors) => ({
  120. /**
  121. * Heading text color
  122. */
  123. headingColor: colors.gray500,
  124. /**
  125. * Primary text color
  126. */
  127. textColor: colors.gray400,
  128. /**
  129. * Text that should not have as much emphasis
  130. */
  131. subText: colors.gray300,
  132. /**
  133. * Background for the main content area of a page?
  134. */
  135. bodyBackground: colors.surface100,
  136. /**
  137. * Primary background color
  138. */
  139. background: colors.surface200,
  140. /**
  141. * Elevated background color
  142. */
  143. backgroundElevated: colors.surface300,
  144. /**
  145. * Secondary background color used as a slight contrast against primary background
  146. */
  147. backgroundSecondary: colors.surface100,
  148. /**
  149. * Background for the header of a page
  150. */
  151. headerBackground: colors.surface200,
  152. /**
  153. * Primary border color
  154. */
  155. border: colors.gray200,
  156. translucentBorder: colors.translucentGray200,
  157. /**
  158. * Inner borders, e.g. borders inside of a grid
  159. */
  160. innerBorder: colors.gray100,
  161. translucentInnerBorder: colors.translucentGray100,
  162. /**
  163. * A color that denotes a "success", or something good
  164. */
  165. success: colors.green300,
  166. successText: colors.green400,
  167. /**
  168. * A color that denotes an error, or something that is wrong
  169. */
  170. error: colors.red300,
  171. errorText: colors.red400,
  172. /**
  173. * A color that indicates something is disabled where user can not interact or use
  174. * it in the usual manner (implies that there is an "enabled" state)
  175. */
  176. disabled: colors.gray300,
  177. disabledBorder: colors.gray200,
  178. /**
  179. * Indicates a "hover" state, to suggest that an interactive element is clickable
  180. */
  181. hover: colors.surface400,
  182. /**
  183. * Indicates that something is "active" or "selected"
  184. */
  185. active: colors.purple300,
  186. activeHover: colors.purple400,
  187. activeText: colors.purple400,
  188. /**
  189. * Indicates that something has "focus", which is different than "active" state as it is more temporal
  190. * and should be a bit subtler than active
  191. */
  192. focus: colors.purple200,
  193. focusBorder: colors.purple300,
  194. /**
  195. * Inactive
  196. */
  197. inactive: colors.gray300,
  198. /**
  199. * Link color indicates that something is clickable
  200. */
  201. linkColor: colors.blue300,
  202. linkHoverColor: colors.blue300,
  203. linkUnderline: colors.blue200,
  204. linkFocus: colors.blue300,
  205. /**
  206. * Form placeholder text color
  207. */
  208. formPlaceholder: colors.gray300,
  209. /**
  210. * Default form text color
  211. */
  212. formText: colors.gray400,
  213. /**
  214. * Form input border
  215. */
  216. formInputBorder: colors.gray200,
  217. /**
  218. *
  219. */
  220. rowBackground: colors.surface300,
  221. /**
  222. * Color of lines that flow across the background of the chart to indicate axes levels
  223. * (This should only be used for yAxis)
  224. */
  225. chartLineColor: colors.gray100,
  226. /**
  227. * Color for chart label text
  228. */
  229. chartLabel: colors.gray300,
  230. /**
  231. * Color for the 'others' series in topEvent charts
  232. */
  233. chartOther: colors.gray200,
  234. /**
  235. * Default Progressbar color
  236. */
  237. progressBar: colors.purple300,
  238. /**
  239. * Default Progressbar color
  240. */
  241. progressBackground: colors.gray100,
  242. /**
  243. * Overlay for partial opacity
  244. */
  245. overlayBackgroundAlpha: color(colors.surface100).alpha(0.7).string(),
  246. /**
  247. * Tag progress bars
  248. */
  249. tagBarHover: colors.purple200,
  250. tagBar: colors.gray200,
  251. /**
  252. * Search filter "token" background
  253. */
  254. searchTokenBackground: {
  255. valid: colors.blue100,
  256. validActive: color(colors.blue100).opaquer(1.0).string(),
  257. invalid: colors.red100,
  258. invalidActive: color(colors.red100).opaquer(0.8).string(),
  259. },
  260. /**
  261. * Search filter "token" border
  262. */
  263. searchTokenBorder: {
  264. valid: colors.blue200,
  265. validActive: color(colors.blue200).opaquer(1).string(),
  266. invalid: colors.red200,
  267. invalidActive: color(colors.red200).opaquer(1).string(),
  268. },
  269. /**
  270. * Count on button when active
  271. */
  272. buttonCountActive: colors.white,
  273. /**
  274. * Count on button
  275. */
  276. buttonCount: colors.gray500,
  277. /**
  278. * Background of alert banners at the top
  279. */
  280. bannerBackground: colors.gray500,
  281. });
  282. const dataCategory = {
  283. [DataCategory.ERRORS]: CHART_PALETTE[4][3],
  284. [DataCategory.TRANSACTIONS]: CHART_PALETTE[4][2],
  285. [DataCategory.ATTACHMENTS]: CHART_PALETTE[4][1],
  286. [DataCategory.DEFAULT]: CHART_PALETTE[4][0],
  287. };
  288. /**
  289. * Default colors for data usage outcomes
  290. */
  291. const outcome = {
  292. [Outcome.ACCEPTED]: CHART_PALETTE[0][0],
  293. [Outcome.FILTERED]: CHART_PALETTE[1][1],
  294. [Outcome.DROPPED]: CHART_PALETTE[5][3],
  295. };
  296. const generateAlertTheme = (colors: BaseColors, alias: Aliases) => ({
  297. muted: {
  298. background: colors.gray200,
  299. backgroundLight: alias.backgroundSecondary,
  300. border: alias.border,
  301. borderHover: alias.border,
  302. iconColor: 'inherit',
  303. iconHoverColor: 'inherit',
  304. },
  305. info: {
  306. background: colors.blue300,
  307. backgroundLight: colors.blue100,
  308. border: colors.blue200,
  309. borderHover: colors.blue300,
  310. iconColor: colors.blue300,
  311. iconHoverColor: colors.blue400,
  312. },
  313. warning: {
  314. background: colors.yellow300,
  315. backgroundLight: colors.yellow100,
  316. border: colors.yellow200,
  317. borderHover: colors.yellow300,
  318. iconColor: colors.yellow300,
  319. iconHoverColor: colors.yellow400,
  320. },
  321. success: {
  322. background: colors.green300,
  323. backgroundLight: colors.green100,
  324. border: colors.green200,
  325. borderHover: colors.green300,
  326. iconColor: colors.green300,
  327. iconHoverColor: colors.green400,
  328. },
  329. error: {
  330. background: colors.red300,
  331. backgroundLight: colors.red100,
  332. border: colors.red200,
  333. borderHover: colors.red300,
  334. iconColor: colors.red300,
  335. iconHoverColor: colors.red400,
  336. textLight: colors.red200,
  337. },
  338. });
  339. const generateBadgeTheme = (colors: BaseColors) => ({
  340. default: {
  341. background: colors.gray100,
  342. indicatorColor: colors.gray100,
  343. color: colors.gray500,
  344. },
  345. alpha: {
  346. background: `linear-gradient(90deg, ${colors.pink300}, ${colors.yellow300})`,
  347. indicatorColor: colors.pink300,
  348. color: colors.white,
  349. },
  350. beta: {
  351. background: `linear-gradient(90deg, ${colors.purple300}, ${colors.pink300})`,
  352. indicatorColor: colors.purple300,
  353. color: colors.white,
  354. },
  355. new: {
  356. background: `linear-gradient(90deg, ${colors.blue300}, ${colors.green300})`,
  357. indicatorColor: colors.green300,
  358. color: colors.white,
  359. },
  360. review: {
  361. background: colors.purple300,
  362. indicatorColor: colors.purple300,
  363. color: colors.white,
  364. },
  365. warning: {
  366. background: colors.yellow300,
  367. indicatorColor: colors.yellow300,
  368. color: colors.gray500,
  369. },
  370. });
  371. const generateTagTheme = (colors: BaseColors) => ({
  372. default: {
  373. background: colors.surface400,
  374. border: colors.gray200,
  375. iconColor: colors.gray300,
  376. },
  377. promotion: {
  378. background: colors.pink100,
  379. border: colors.pink200,
  380. iconColor: colors.pink300,
  381. },
  382. highlight: {
  383. background: colors.purple100,
  384. border: colors.purple200,
  385. iconColor: colors.purple300,
  386. },
  387. warning: {
  388. background: colors.yellow100,
  389. border: colors.yellow200,
  390. iconColor: colors.yellow300,
  391. },
  392. success: {
  393. background: colors.green100,
  394. border: colors.green200,
  395. iconColor: colors.green300,
  396. },
  397. error: {
  398. background: colors.red100,
  399. border: colors.red200,
  400. iconColor: colors.red300,
  401. },
  402. info: {
  403. background: colors.purple100,
  404. border: colors.purple200,
  405. iconColor: colors.purple300,
  406. },
  407. white: {
  408. background: colors.white,
  409. border: colors.white,
  410. iconColor: colors.black,
  411. },
  412. black: {
  413. background: colors.black,
  414. border: colors.black,
  415. iconColor: colors.white,
  416. },
  417. });
  418. const generateLevelTheme = (colors: BaseColors) => ({
  419. sample: colors.purple300,
  420. info: colors.blue300,
  421. warning: colors.yellow300,
  422. // Hardcoded legacy color (orange400). We no longer use orange anywhere
  423. // else in the app (except for the chart palette). This needs to be harcoded
  424. // here because existing users may still associate orange with the "error" level.
  425. error: '#FF7738',
  426. fatal: colors.red300,
  427. default: colors.gray300,
  428. unknown: colors.gray200,
  429. });
  430. const generateButtonTheme = (colors: BaseColors, alias: Aliases) => ({
  431. borderRadius: '4px',
  432. default: {
  433. color: alias.textColor,
  434. colorActive: alias.textColor,
  435. background: alias.background,
  436. backgroundActive: alias.hover,
  437. border: alias.border,
  438. borderActive: alias.border,
  439. borderTranslucent: alias.translucentBorder,
  440. focusBorder: alias.focusBorder,
  441. focusShadow: alias.focus,
  442. },
  443. primary: {
  444. color: colors.white,
  445. colorActive: colors.white,
  446. background: colors.purple300,
  447. backgroundActive: colors.purple400,
  448. border: colors.purple300,
  449. borderActive: colors.purple300,
  450. borderTranslucent: colors.purple300,
  451. focusBorder: alias.focusBorder,
  452. focusShadow: alias.focus,
  453. },
  454. danger: {
  455. color: colors.white,
  456. colorActive: colors.white,
  457. background: colors.red300,
  458. backgroundActive: colors.red400,
  459. border: colors.red300,
  460. borderActive: colors.red300,
  461. borderTranslucent: colors.red300,
  462. focusBorder: colors.red300,
  463. focusShadow: colors.red200,
  464. },
  465. link: {
  466. color: colors.blue300,
  467. colorActive: colors.blue300,
  468. background: 'transparent',
  469. backgroundActive: 'transparent',
  470. border: 'transparent',
  471. borderActive: 'transparent',
  472. borderTranslucent: 'transparent',
  473. focusBorder: alias.focusBorder,
  474. focusShadow: alias.focus,
  475. },
  476. disabled: {
  477. color: alias.disabled,
  478. colorActive: alias.disabled,
  479. background: alias.background,
  480. backgroundActive: alias.background,
  481. border: alias.disabledBorder,
  482. borderActive: alias.disabledBorder,
  483. borderTranslucent: alias.translucentInnerBorder,
  484. focusBorder: 'transparent',
  485. focusShadow: 'transparent',
  486. },
  487. form: {
  488. color: alias.textColor,
  489. colorActive: alias.textColor,
  490. background: alias.background,
  491. backgroundActive: alias.hover,
  492. border: alias.formInputBorder,
  493. borderActive: alias.formInputBorder,
  494. borderTranslucent: alias.translucentBorder,
  495. focusBorder: alias.focusBorder,
  496. focusShadow: alias.focus,
  497. },
  498. });
  499. const generateUtils = (colors: BaseColors, aliases: Aliases) => ({
  500. tooltipUnderline: (underlineColor: ColorOrAlias = 'gray300') => ({
  501. textDecoration: `underline dotted ${
  502. colors[underlineColor] ?? aliases[underlineColor]
  503. }`,
  504. textDecorationThickness: '0.75px',
  505. textUnderlineOffset: '1.25px',
  506. }),
  507. overflowEllipsis: css({
  508. display: 'block',
  509. width: '100%',
  510. whiteSpace: 'nowrap',
  511. overflow: 'hidden',
  512. textOverflow: 'ellipsis',
  513. }),
  514. });
  515. const iconSizes = {
  516. xs: '12px',
  517. sm: '16px',
  518. md: '20px',
  519. lg: '24px',
  520. xl: '32px',
  521. xxl: '72px',
  522. };
  523. const commonTheme = {
  524. breakpoints: {
  525. small: '800px',
  526. medium: '992px',
  527. large: '1200px',
  528. xlarge: '1440px',
  529. xxlarge: '2560px',
  530. },
  531. ...lightColors,
  532. ...lightShadows,
  533. iconSizes,
  534. iconDirections: {
  535. up: '0',
  536. right: '90',
  537. down: '180',
  538. left: '270',
  539. },
  540. // Try to keep these ordered plz
  541. zIndex: {
  542. // Generic z-index when you hope your component is isolated and
  543. // does not need to battle others for z-index priority
  544. initial: 1,
  545. truncationFullValue: 10,
  546. traceView: {
  547. spanTreeToggler: 900,
  548. dividerLine: 909,
  549. rowInfoMessage: 910,
  550. minimapContainer: 999,
  551. },
  552. header: 1000,
  553. errorMessage: 1000,
  554. dropdown: 1001,
  555. dropdownAutocomplete: {
  556. // needs to be below actor but above other page elements (e.g. pagination)
  557. // (e.g. Issue Details "seen" dots on chart is 2)
  558. // stream header is 1000
  559. menu: 1007,
  560. // needs to be above menu
  561. actor: 1008,
  562. },
  563. globalSelectionHeader: 1009,
  564. settingsSidebarNavMask: 1017,
  565. settingsSidebarNav: 1018,
  566. sidebarPanel: 1019,
  567. sidebar: 1020,
  568. orgAndUserMenu: 1030,
  569. // Sentry user feedback modal
  570. sentryErrorEmbed: 1090,
  571. // If you change modal also update shared-components.less
  572. // as the z-index for bootstrap modals lives there.
  573. modal: 10000,
  574. toast: 10001,
  575. // tooltips and hovercards can be inside modals sometimes.
  576. hovercard: 10002,
  577. tooltip: 10003,
  578. // On mobile views issue list dropdowns overlap
  579. issuesList: {
  580. stickyHeader: 1,
  581. sortOptions: 2,
  582. displayOptions: 3,
  583. },
  584. },
  585. grid: 8,
  586. borderRadius: '4px',
  587. borderRadiusBottom: '0 0 4px 4px',
  588. borderRadiusTop: '4px 4px 0 0',
  589. borderRadiusLeft: '4px 0 0 4px',
  590. borderRadiusRight: '0 4px 4px 0',
  591. headerSelectorRowHeight: 44,
  592. headerSelectorLabelHeight: 28,
  593. // Relative font sizes
  594. fontSizeRelativeSmall: '0.9em',
  595. fontSizeExtraSmall: '11px',
  596. fontSizeSmall: '12px',
  597. fontSizeMedium: '14px',
  598. fontSizeLarge: '16px',
  599. fontSizeExtraLarge: '18px',
  600. headerFontSize: '22px',
  601. settings: {
  602. // Max-width for settings breadcrumbs
  603. // i.e. organization, project, or team
  604. maxCrumbWidth: '240px',
  605. containerWidth: '1440px',
  606. headerHeight: '69px',
  607. sidebarWidth: '220px',
  608. },
  609. sidebar: {
  610. boxShadow: '0 3px 3px #2f2936',
  611. color: '#9586a5',
  612. divider: '#493e54',
  613. badgeSize: '22px',
  614. smallBadgeSize: '11px',
  615. collapsedWidth: '70px',
  616. expandedWidth: '220px',
  617. mobileHeight: '54px',
  618. menuSpacing: '15px',
  619. },
  620. text: {
  621. family: '"Rubik", "Avenir Next", sans-serif',
  622. familyMono: '"Roboto Mono", Monaco, Consolas, "Courier New", monospace',
  623. lineHeightHeading: 1.2,
  624. lineHeightBody: 1.4,
  625. pageTitle: {
  626. fontSize: '1.625rem',
  627. fontWeight: 600,
  628. letterSpacing: '-0.01em',
  629. lineHeight: 1.2,
  630. },
  631. cardTitle: {
  632. fontSize: '1rem',
  633. fontWeight: 600,
  634. lineHeight: 1.2,
  635. },
  636. },
  637. /**
  638. * Common styles for form inputs & buttons, separated by size.
  639. * Should be used to ensure consistent sizing among form elements.
  640. */
  641. form: {
  642. md: {
  643. height: 38,
  644. minHeight: 38,
  645. fontSize: '0.875rem',
  646. lineHeight: '1rem',
  647. },
  648. sm: {
  649. height: 32,
  650. minHeight: 32,
  651. fontSize: '0.875rem',
  652. lineHeight: '1rem',
  653. },
  654. xs: {
  655. height: 26,
  656. minHeight: 26,
  657. fontSize: '0.75rem',
  658. lineHeight: '0.875rem',
  659. },
  660. },
  661. /**
  662. * Padding for buttons
  663. */
  664. buttonPadding: {
  665. md: {
  666. paddingLeft: 16,
  667. paddingRight: 16,
  668. paddingTop: 10,
  669. paddingBottom: 10,
  670. },
  671. sm: {
  672. paddingLeft: 12,
  673. paddingRight: 12,
  674. paddingTop: 8,
  675. paddingBottom: 8,
  676. },
  677. xs: {
  678. paddingLeft: 8,
  679. paddingRight: 8,
  680. paddingTop: 6,
  681. paddingBottom: 6,
  682. },
  683. },
  684. /**
  685. * Padding for form inputs
  686. */
  687. formPadding: {
  688. md: {
  689. paddingLeft: 16,
  690. paddingRight: 12,
  691. paddingTop: 10,
  692. paddingBottom: 10,
  693. },
  694. sm: {
  695. paddingLeft: 12,
  696. paddingRight: 10,
  697. paddingTop: 8,
  698. paddingBottom: 8,
  699. },
  700. xs: {
  701. paddingLeft: 8,
  702. paddingRight: 6,
  703. paddingTop: 6,
  704. paddingBottom: 6,
  705. },
  706. },
  707. dataCategory,
  708. outcome,
  709. tag: generateTagTheme(lightColors),
  710. level: generateLevelTheme(lightColors),
  711. charts: {
  712. colors: CHART_PALETTE[CHART_PALETTE.length - 1],
  713. // We have an array that maps `number + 1` --> list of `number` colors
  714. getColorPalette: (length: number) =>
  715. CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)] as string[],
  716. previousPeriod: lightColors.gray200,
  717. symbolSize: 6,
  718. },
  719. diff: {
  720. removedRow: 'hsl(358deg 89% 65% / 15%)',
  721. removed: 'hsl(358deg 89% 65% / 30%)',
  722. addedRow: 'hsl(100deg 100% 87% / 18%)',
  723. added: 'hsl(166deg 58% 47% / 32%)',
  724. },
  725. // Similarity spectrum used in "Similar Issues" in group details
  726. similarity: {
  727. empty: '#e2dee6',
  728. colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'],
  729. },
  730. // used as a gradient,
  731. businessIconColors: ['#EA5BC2', '#6148CE'],
  732. demo: {
  733. headerSize: '70px',
  734. },
  735. };
  736. const lightAliases = generateAliases(lightColors);
  737. const darkAliases = generateAliases(darkColors);
  738. export const lightTheme = {
  739. ...commonTheme,
  740. ...lightColors,
  741. ...lightAliases,
  742. ...lightShadows,
  743. inverted: {
  744. ...darkColors,
  745. ...darkAliases,
  746. },
  747. ...generateUtils(lightColors, lightAliases),
  748. alert: generateAlertTheme(lightColors, lightAliases),
  749. badge: generateBadgeTheme(lightColors),
  750. button: generateButtonTheme(lightColors, lightAliases),
  751. tag: generateTagTheme(lightColors),
  752. level: generateLevelTheme(lightColors),
  753. sidebar: {
  754. ...commonTheme.sidebar,
  755. background: sidebarBackground.light,
  756. },
  757. sidebarGradient: `linear-gradient(294.17deg,${sidebarBackground.light} 35.57%,#452650 92.42%,#452650 92.42%)`,
  758. sidebarBorder: 'transparent',
  759. };
  760. export const darkTheme: Theme = {
  761. ...commonTheme,
  762. ...darkColors,
  763. ...darkAliases,
  764. ...darkShadows,
  765. inverted: {
  766. ...lightColors,
  767. ...lightAliases,
  768. },
  769. ...generateUtils(darkColors, lightAliases),
  770. alert: generateAlertTheme(darkColors, darkAliases),
  771. badge: generateBadgeTheme(darkColors),
  772. button: generateButtonTheme(darkColors, darkAliases),
  773. tag: generateTagTheme(darkColors),
  774. level: generateLevelTheme(darkColors),
  775. sidebar: {
  776. ...commonTheme.sidebar,
  777. background: sidebarBackground.dark,
  778. },
  779. sidebarGradient: `linear-gradient(180deg, ${sidebarBackground.dark} 0%, #1B1825 100%)`,
  780. sidebarBorder: darkAliases.border,
  781. };
  782. export type Theme = typeof lightTheme;
  783. export type Color = keyof typeof lightColors;
  784. export type Aliases = typeof lightAliases;
  785. export type ColorOrAlias = keyof Aliases | Color;
  786. export type IconSize = keyof typeof iconSizes;
  787. export type FormSize = keyof Theme['form'];
  788. export default commonTheme;
  789. type MyTheme = Theme;
  790. /**
  791. * Configure Emotion to use our theme
  792. */
  793. declare module '@emotion/react' {
  794. // eslint-disable-next-line @typescript-eslint/no-shadow
  795. export interface Theme extends MyTheme {}
  796. }
  797. // This should never be used directly (except in storybook)
  798. export {lightAliases as aliases};