theme.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. import {css} from '@emotion/react';
  2. import color from 'color';
  3. import CHART_PALETTE from 'sentry/constants/chartPalette';
  4. import {DataCategory} 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. const generateAlertTheme = (colors: BaseColors, alias: Aliases) => ({
  289. muted: {
  290. background: colors.gray200,
  291. backgroundLight: alias.backgroundSecondary,
  292. border: alias.border,
  293. borderHover: alias.border,
  294. iconColor: 'inherit',
  295. iconHoverColor: 'inherit',
  296. },
  297. info: {
  298. background: colors.blue300,
  299. backgroundLight: colors.blue100,
  300. border: colors.blue200,
  301. borderHover: colors.blue300,
  302. iconColor: colors.blue300,
  303. iconHoverColor: colors.blue400,
  304. },
  305. warning: {
  306. background: colors.yellow300,
  307. backgroundLight: colors.yellow100,
  308. border: colors.yellow200,
  309. borderHover: colors.yellow300,
  310. iconColor: colors.yellow300,
  311. iconHoverColor: colors.yellow400,
  312. },
  313. success: {
  314. background: colors.green300,
  315. backgroundLight: colors.green100,
  316. border: colors.green200,
  317. borderHover: colors.green300,
  318. iconColor: colors.green300,
  319. iconHoverColor: colors.green400,
  320. },
  321. error: {
  322. background: colors.red300,
  323. backgroundLight: colors.red100,
  324. border: colors.red200,
  325. borderHover: colors.red300,
  326. iconColor: colors.red300,
  327. iconHoverColor: colors.red400,
  328. textLight: colors.red200,
  329. },
  330. });
  331. const generateBadgeTheme = (colors: BaseColors) => ({
  332. default: {
  333. background: colors.gray100,
  334. indicatorColor: colors.gray100,
  335. color: colors.gray500,
  336. },
  337. alpha: {
  338. background: `linear-gradient(90deg, ${colors.pink300}, ${colors.yellow300})`,
  339. indicatorColor: colors.pink300,
  340. color: colors.white,
  341. },
  342. beta: {
  343. background: `linear-gradient(90deg, ${colors.purple300}, ${colors.pink300})`,
  344. indicatorColor: colors.purple300,
  345. color: colors.white,
  346. },
  347. new: {
  348. background: `linear-gradient(90deg, ${colors.blue300}, ${colors.green300})`,
  349. indicatorColor: colors.green300,
  350. color: colors.white,
  351. },
  352. review: {
  353. background: colors.purple300,
  354. indicatorColor: colors.purple300,
  355. color: colors.white,
  356. },
  357. warning: {
  358. background: colors.yellow300,
  359. indicatorColor: colors.yellow300,
  360. color: colors.gray500,
  361. },
  362. });
  363. const generateTagTheme = (colors: BaseColors) => ({
  364. default: {
  365. background: colors.surface400,
  366. border: colors.gray200,
  367. iconColor: colors.gray300,
  368. },
  369. promotion: {
  370. background: colors.pink100,
  371. border: colors.pink200,
  372. iconColor: colors.pink300,
  373. },
  374. highlight: {
  375. background: colors.purple100,
  376. border: colors.purple200,
  377. iconColor: colors.purple300,
  378. },
  379. warning: {
  380. background: colors.yellow100,
  381. border: colors.yellow200,
  382. iconColor: colors.yellow300,
  383. },
  384. success: {
  385. background: colors.green100,
  386. border: colors.green200,
  387. iconColor: colors.green300,
  388. },
  389. error: {
  390. background: colors.red100,
  391. border: colors.red200,
  392. iconColor: colors.red300,
  393. },
  394. info: {
  395. background: colors.purple100,
  396. border: colors.purple200,
  397. iconColor: colors.purple300,
  398. },
  399. white: {
  400. background: colors.white,
  401. border: colors.white,
  402. iconColor: colors.black,
  403. },
  404. black: {
  405. background: colors.black,
  406. border: colors.black,
  407. iconColor: colors.white,
  408. },
  409. });
  410. const generateLevelTheme = (colors: BaseColors) => ({
  411. sample: colors.purple300,
  412. info: colors.blue300,
  413. warning: colors.yellow300,
  414. // Hardcoded legacy color (orange400). We no longer use orange anywhere
  415. // else in the app (except for the chart palette). This needs to be harcoded
  416. // here because existing users may still associate orange with the "error" level.
  417. error: '#FF7738',
  418. fatal: colors.red300,
  419. default: colors.gray300,
  420. });
  421. const generateButtonTheme = (colors: BaseColors, alias: Aliases) => ({
  422. borderRadius: '4px',
  423. default: {
  424. color: alias.textColor,
  425. colorActive: alias.textColor,
  426. background: alias.background,
  427. backgroundActive: alias.hover,
  428. border: alias.border,
  429. borderActive: alias.border,
  430. borderTranslucent: alias.translucentBorder,
  431. focusBorder: alias.focusBorder,
  432. focusShadow: alias.focus,
  433. },
  434. primary: {
  435. color: colors.white,
  436. colorActive: colors.white,
  437. background: colors.purple300,
  438. backgroundActive: colors.purple400,
  439. border: colors.purple300,
  440. borderActive: colors.purple300,
  441. borderTranslucent: colors.purple300,
  442. focusBorder: alias.focusBorder,
  443. focusShadow: alias.focus,
  444. },
  445. danger: {
  446. color: colors.white,
  447. colorActive: colors.white,
  448. background: colors.red300,
  449. backgroundActive: colors.red400,
  450. border: colors.red300,
  451. borderActive: colors.red300,
  452. borderTranslucent: colors.red300,
  453. focusBorder: colors.red300,
  454. focusShadow: colors.red200,
  455. },
  456. link: {
  457. color: colors.blue300,
  458. colorActive: colors.blue300,
  459. background: 'transparent',
  460. backgroundActive: 'transparent',
  461. border: 'transparent',
  462. borderActive: 'transparent',
  463. borderTranslucent: 'transparent',
  464. focusBorder: alias.focusBorder,
  465. focusShadow: alias.focus,
  466. },
  467. disabled: {
  468. color: alias.disabled,
  469. colorActive: alias.disabled,
  470. background: alias.background,
  471. backgroundActive: alias.background,
  472. border: alias.disabledBorder,
  473. borderActive: alias.disabledBorder,
  474. borderTranslucent: alias.translucentInnerBorder,
  475. focusBorder: 'transparent',
  476. focusShadow: 'transparent',
  477. },
  478. form: {
  479. color: alias.textColor,
  480. colorActive: alias.textColor,
  481. background: alias.background,
  482. backgroundActive: alias.hover,
  483. border: alias.formInputBorder,
  484. borderActive: alias.formInputBorder,
  485. borderTranslucent: alias.translucentBorder,
  486. focusBorder: alias.focusBorder,
  487. focusShadow: alias.focus,
  488. },
  489. });
  490. const generateUtils = (colors: BaseColors, aliases: Aliases) => ({
  491. tooltipUnderline: (underlineColor: ColorOrAlias = 'gray300') => ({
  492. textDecoration: `underline dotted ${
  493. colors[underlineColor] ?? aliases[underlineColor]
  494. }`,
  495. textDecorationThickness: '0.75px',
  496. textUnderlineOffset: '1.25px',
  497. }),
  498. overflowEllipsis: css({
  499. display: 'block',
  500. width: '100%',
  501. whiteSpace: 'nowrap',
  502. overflow: 'hidden',
  503. textOverflow: 'ellipsis',
  504. }),
  505. });
  506. const iconSizes = {
  507. xs: '12px',
  508. sm: '16px',
  509. md: '20px',
  510. lg: '24px',
  511. xl: '32px',
  512. xxl: '72px',
  513. };
  514. const commonTheme = {
  515. breakpoints: {
  516. small: '800px',
  517. medium: '992px',
  518. large: '1200px',
  519. xlarge: '1440px',
  520. xxlarge: '2560px',
  521. },
  522. ...lightColors,
  523. ...lightShadows,
  524. iconSizes,
  525. iconDirections: {
  526. up: '0',
  527. right: '90',
  528. down: '180',
  529. left: '270',
  530. },
  531. // Try to keep these ordered plz
  532. zIndex: {
  533. // Generic z-index when you hope your component is isolated and
  534. // does not need to battle others for z-index priority
  535. initial: 1,
  536. truncationFullValue: 10,
  537. traceView: {
  538. spanTreeToggler: 900,
  539. dividerLine: 909,
  540. rowInfoMessage: 910,
  541. minimapContainer: 999,
  542. },
  543. header: 1000,
  544. errorMessage: 1000,
  545. dropdown: 1001,
  546. dropdownAutocomplete: {
  547. // needs to be below actor but above other page elements (e.g. pagination)
  548. // (e.g. Issue Details "seen" dots on chart is 2)
  549. // stream header is 1000
  550. menu: 1007,
  551. // needs to be above menu
  552. actor: 1008,
  553. },
  554. globalSelectionHeader: 1009,
  555. settingsSidebarNavMask: 1017,
  556. settingsSidebarNav: 1018,
  557. sidebarPanel: 1019,
  558. sidebar: 1020,
  559. orgAndUserMenu: 1030,
  560. // Sentry user feedback modal
  561. sentryErrorEmbed: 1090,
  562. // If you change modal also update shared-components.less
  563. // as the z-index for bootstrap modals lives there.
  564. modal: 10000,
  565. toast: 10001,
  566. // tooltips and hovercards can be inside modals sometimes.
  567. hovercard: 10002,
  568. tooltip: 10003,
  569. // On mobile views issue list dropdowns overlap
  570. issuesList: {
  571. stickyHeader: 1,
  572. sortOptions: 2,
  573. displayOptions: 3,
  574. },
  575. },
  576. grid: 8,
  577. borderRadius: '4px',
  578. borderRadiusBottom: '0 0 4px 4px',
  579. borderRadiusTop: '4px 4px 0 0',
  580. borderRadiusLeft: '4px 0 0 4px',
  581. borderRadiusRight: '0 4px 4px 0',
  582. headerSelectorRowHeight: 44,
  583. headerSelectorLabelHeight: 28,
  584. // Relative font sizes
  585. fontSizeRelativeSmall: '0.9em',
  586. fontSizeExtraSmall: '11px',
  587. fontSizeSmall: '12px',
  588. fontSizeMedium: '14px',
  589. fontSizeLarge: '16px',
  590. fontSizeExtraLarge: '18px',
  591. headerFontSize: '22px',
  592. settings: {
  593. // Max-width for settings breadcrumbs
  594. // i.e. organization, project, or team
  595. maxCrumbWidth: '240px',
  596. containerWidth: '1440px',
  597. headerHeight: '69px',
  598. sidebarWidth: '220px',
  599. },
  600. sidebar: {
  601. boxShadow: '0 3px 3px #2f2936',
  602. color: '#9586a5',
  603. divider: '#493e54',
  604. badgeSize: '22px',
  605. smallBadgeSize: '11px',
  606. collapsedWidth: '70px',
  607. expandedWidth: '220px',
  608. mobileHeight: '54px',
  609. menuSpacing: '15px',
  610. },
  611. text: {
  612. family: '"Rubik", "Avenir Next", sans-serif',
  613. familyMono: '"Roboto Mono", Monaco, Consolas, "Courier New", monospace',
  614. lineHeightHeading: 1.2,
  615. lineHeightBody: 1.4,
  616. pageTitle: {
  617. fontSize: '1.625rem',
  618. fontWeight: 600,
  619. letterSpacing: '-0.01em',
  620. lineHeight: 1.2,
  621. },
  622. cardTitle: {
  623. fontSize: '1rem',
  624. fontWeight: 600,
  625. lineHeight: 1.2,
  626. },
  627. },
  628. /**
  629. * Common styles for form inputs & buttons, separated by size.
  630. * Should be used to ensure consistent sizing among form elements.
  631. */
  632. form: {
  633. md: {
  634. height: 40,
  635. minHeight: 40,
  636. fontSize: '0.875rem',
  637. lineHeight: '1rem',
  638. },
  639. sm: {
  640. height: 34,
  641. minHeight: 34,
  642. fontSize: '0.875rem',
  643. lineHeight: '1rem',
  644. },
  645. xs: {
  646. height: 28,
  647. minHeight: 28,
  648. fontSize: '0.75rem',
  649. lineHeight: '0.875rem',
  650. },
  651. },
  652. /**
  653. * Padding for buttons
  654. */
  655. buttonPadding: {
  656. md: {
  657. paddingTop: 10,
  658. paddingBottom: 10,
  659. paddingLeft: 16,
  660. paddingRight: 16,
  661. },
  662. sm: {
  663. paddingTop: 8,
  664. paddingBottom: 8,
  665. paddingLeft: 12,
  666. paddingRight: 12,
  667. },
  668. xs: {
  669. paddingTop: 6,
  670. paddingBottom: 6,
  671. paddingLeft: 8,
  672. paddingRight: 8,
  673. },
  674. },
  675. dataCategory,
  676. tag: generateTagTheme(lightColors),
  677. level: generateLevelTheme(lightColors),
  678. charts: {
  679. colors: CHART_PALETTE[CHART_PALETTE.length - 1],
  680. // We have an array that maps `number + 1` --> list of `number` colors
  681. getColorPalette: (length: number) =>
  682. CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)] as string[],
  683. previousPeriod: lightColors.gray200,
  684. symbolSize: 6,
  685. },
  686. diff: {
  687. removedRow: 'hsl(358deg 89% 65% / 15%)',
  688. removed: 'hsl(358deg 89% 65% / 30%)',
  689. addedRow: 'hsl(100deg 100% 87% / 18%)',
  690. added: 'hsl(166deg 58% 47% / 32%)',
  691. },
  692. // Similarity spectrum used in "Similar Issues" in group details
  693. similarity: {
  694. empty: '#e2dee6',
  695. colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'],
  696. },
  697. // used as a gradient,
  698. businessIconColors: ['#EA5BC2', '#6148CE'],
  699. demo: {
  700. headerSize: '70px',
  701. },
  702. };
  703. const lightAliases = generateAliases(lightColors);
  704. const darkAliases = generateAliases(darkColors);
  705. export const lightTheme = {
  706. ...commonTheme,
  707. ...lightColors,
  708. ...lightAliases,
  709. ...lightShadows,
  710. inverted: {
  711. ...darkColors,
  712. ...darkAliases,
  713. },
  714. ...generateUtils(lightColors, lightAliases),
  715. alert: generateAlertTheme(lightColors, lightAliases),
  716. badge: generateBadgeTheme(lightColors),
  717. button: generateButtonTheme(lightColors, lightAliases),
  718. tag: generateTagTheme(lightColors),
  719. level: generateLevelTheme(lightColors),
  720. sidebar: {
  721. ...commonTheme.sidebar,
  722. background: sidebarBackground.light,
  723. },
  724. sidebarGradient: `linear-gradient(294.17deg,${sidebarBackground.light} 35.57%,#452650 92.42%,#452650 92.42%)`,
  725. sidebarBorder: 'transparent',
  726. };
  727. export const darkTheme: Theme = {
  728. ...commonTheme,
  729. ...darkColors,
  730. ...darkAliases,
  731. ...darkShadows,
  732. inverted: {
  733. ...lightColors,
  734. ...lightAliases,
  735. },
  736. ...generateUtils(darkColors, lightAliases),
  737. alert: generateAlertTheme(darkColors, darkAliases),
  738. badge: generateBadgeTheme(darkColors),
  739. button: generateButtonTheme(darkColors, darkAliases),
  740. tag: generateTagTheme(darkColors),
  741. level: generateLevelTheme(darkColors),
  742. sidebar: {
  743. ...commonTheme.sidebar,
  744. background: sidebarBackground.dark,
  745. },
  746. sidebarGradient: `linear-gradient(180deg, ${sidebarBackground.dark} 0%, #1B1825 100%)`,
  747. sidebarBorder: darkAliases.border,
  748. };
  749. export type Theme = typeof lightTheme;
  750. export type Color = keyof typeof lightColors;
  751. export type Aliases = typeof lightAliases;
  752. export type ColorOrAlias = keyof Aliases | Color;
  753. export type IconSize = keyof typeof iconSizes;
  754. export default commonTheme;
  755. type MyTheme = Theme;
  756. /**
  757. * Configure Emotion to use our theme
  758. */
  759. declare module '@emotion/react' {
  760. // eslint-disable-next-line @typescript-eslint/no-shadow
  761. export interface Theme extends MyTheme {}
  762. }
  763. // This should never be used directly (except in storybook)
  764. export {lightAliases as aliases};