theme.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. import '@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.1)',
  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. /**
  204. * Form placeholder text color
  205. */
  206. formPlaceholder: colors.gray300,
  207. /**
  208. * Default form text color
  209. */
  210. formText: colors.gray400,
  211. /**
  212. * Form input border
  213. */
  214. formInputBorder: colors.gray200,
  215. /**
  216. *
  217. */
  218. rowBackground: colors.surface300,
  219. /**
  220. * Color of lines that flow across the background of the chart to indicate axes levels
  221. * (This should only be used for yAxis)
  222. */
  223. chartLineColor: colors.gray100,
  224. /**
  225. * Color for chart label text
  226. */
  227. chartLabel: colors.gray300,
  228. /**
  229. * Color for the 'others' series in topEvent charts
  230. */
  231. chartOther: colors.gray200,
  232. /**
  233. * Default Progressbar color
  234. */
  235. progressBar: colors.purple300,
  236. /**
  237. * Default Progressbar color
  238. */
  239. progressBackground: colors.gray100,
  240. /**
  241. * Overlay for partial opacity
  242. */
  243. overlayBackgroundAlpha: color(colors.surface100).alpha(0.7).string(),
  244. /**
  245. * Tag progress bars
  246. */
  247. tagBarHover: colors.purple200,
  248. tagBar: colors.gray200,
  249. /**
  250. * Search filter "token" background
  251. */
  252. searchTokenBackground: {
  253. valid: colors.blue100,
  254. validActive: color(colors.blue100).opaquer(0.2).string(),
  255. invalid: colors.red100,
  256. invalidActive: color(colors.red100).opaquer(0.2).string(),
  257. },
  258. /**
  259. * Search filter "token" border
  260. */
  261. searchTokenBorder: {
  262. valid: colors.blue200,
  263. validActive: color(colors.blue200).opaquer(0.4).string(),
  264. invalid: colors.red200,
  265. invalidActive: color(colors.red200).opaquer(0.4).string(),
  266. },
  267. /**
  268. * Count on button when active
  269. */
  270. buttonCountActive: colors.white,
  271. /**
  272. * Count on button
  273. */
  274. buttonCount: colors.gray500,
  275. /**
  276. * Background of alert banners at the top
  277. */
  278. bannerBackground: colors.gray500,
  279. });
  280. const dataCategory = {
  281. [DataCategory.ERRORS]: CHART_PALETTE[4][3],
  282. [DataCategory.TRANSACTIONS]: CHART_PALETTE[4][2],
  283. [DataCategory.ATTACHMENTS]: CHART_PALETTE[4][1],
  284. [DataCategory.DEFAULT]: CHART_PALETTE[4][0],
  285. };
  286. const generateAlertTheme = (colors: BaseColors, alias: Aliases) => ({
  287. muted: {
  288. background: colors.gray200,
  289. backgroundLight: alias.backgroundSecondary,
  290. border: alias.border,
  291. borderHover: alias.border,
  292. iconColor: 'inherit',
  293. iconHoverColor: 'inherit',
  294. },
  295. info: {
  296. background: colors.blue300,
  297. backgroundLight: colors.blue100,
  298. border: colors.blue200,
  299. borderHover: colors.blue300,
  300. iconColor: colors.blue300,
  301. iconHoverColor: colors.blue400,
  302. },
  303. warning: {
  304. background: colors.yellow300,
  305. backgroundLight: colors.yellow100,
  306. border: colors.yellow200,
  307. borderHover: colors.yellow300,
  308. iconColor: colors.yellow300,
  309. iconHoverColor: colors.yellow400,
  310. },
  311. success: {
  312. background: colors.green300,
  313. backgroundLight: colors.green100,
  314. border: colors.green200,
  315. borderHover: colors.green300,
  316. iconColor: colors.green300,
  317. iconHoverColor: colors.green400,
  318. },
  319. error: {
  320. background: colors.red300,
  321. backgroundLight: colors.red100,
  322. border: colors.red200,
  323. borderHover: colors.red300,
  324. iconColor: colors.red300,
  325. iconHoverColor: colors.red400,
  326. textLight: colors.red200,
  327. },
  328. });
  329. const generateBadgeTheme = (colors: BaseColors) => ({
  330. default: {
  331. background: colors.gray100,
  332. indicatorColor: colors.gray100,
  333. color: colors.gray500,
  334. },
  335. alpha: {
  336. background: `linear-gradient(90deg, ${colors.pink300}, ${colors.yellow300})`,
  337. indicatorColor: colors.pink300,
  338. color: colors.white,
  339. },
  340. beta: {
  341. background: `linear-gradient(90deg, ${colors.purple300}, ${colors.pink300})`,
  342. indicatorColor: colors.purple300,
  343. color: colors.white,
  344. },
  345. new: {
  346. background: `linear-gradient(90deg, ${colors.blue300}, ${colors.green300})`,
  347. indicatorColor: colors.green300,
  348. color: colors.white,
  349. },
  350. review: {
  351. background: colors.purple300,
  352. indicatorColor: colors.purple300,
  353. color: colors.white,
  354. },
  355. warning: {
  356. background: colors.yellow300,
  357. indicatorColor: colors.yellow300,
  358. color: colors.gray500,
  359. },
  360. });
  361. const generateTagTheme = (colors: BaseColors) => ({
  362. default: {
  363. background: colors.surface400,
  364. border: colors.gray200,
  365. iconColor: colors.gray300,
  366. },
  367. promotion: {
  368. background: colors.pink100,
  369. border: colors.pink200,
  370. iconColor: colors.pink300,
  371. },
  372. highlight: {
  373. background: colors.purple100,
  374. border: colors.purple200,
  375. iconColor: colors.purple300,
  376. },
  377. warning: {
  378. background: colors.yellow100,
  379. border: colors.yellow200,
  380. iconColor: colors.yellow300,
  381. },
  382. success: {
  383. background: colors.green100,
  384. border: colors.green200,
  385. iconColor: colors.green300,
  386. },
  387. error: {
  388. background: colors.red100,
  389. border: colors.red200,
  390. iconColor: colors.red300,
  391. },
  392. info: {
  393. background: colors.purple100,
  394. border: colors.purple200,
  395. iconColor: colors.purple300,
  396. },
  397. white: {
  398. background: colors.white,
  399. border: colors.white,
  400. iconColor: colors.black,
  401. },
  402. black: {
  403. background: colors.black,
  404. border: colors.black,
  405. iconColor: colors.white,
  406. },
  407. });
  408. const generateLevelTheme = (colors: BaseColors) => ({
  409. sample: colors.purple300,
  410. info: colors.blue300,
  411. warning: colors.yellow300,
  412. // Hardcoded legacy color (orange400). We no longer use orange anywhere
  413. // else in the app (except for the chart palette). This needs to be harcoded
  414. // here because existing users may still associate orange with the "error" level.
  415. error: '#FF7738',
  416. fatal: colors.red300,
  417. default: colors.gray300,
  418. });
  419. const generateButtonTheme = (colors: BaseColors, alias: Aliases) => ({
  420. borderRadius: '4px',
  421. default: {
  422. color: alias.textColor,
  423. colorActive: alias.textColor,
  424. background: alias.background,
  425. backgroundActive: alias.hover,
  426. border: alias.border,
  427. borderActive: alias.border,
  428. borderTranslucent: alias.translucentBorder,
  429. focusBorder: alias.focusBorder,
  430. focusShadow: alias.focus,
  431. },
  432. primary: {
  433. color: colors.white,
  434. colorActive: colors.white,
  435. background: colors.purple300,
  436. backgroundActive: colors.purple400,
  437. border: colors.purple300,
  438. borderActive: colors.purple300,
  439. borderTranslucent: colors.purple300,
  440. focusBorder: alias.focusBorder,
  441. focusShadow: alias.focus,
  442. },
  443. success: {
  444. color: colors.white,
  445. colorActive: colors.white,
  446. background: colors.green300,
  447. backgroundActive: colors.green400,
  448. border: colors.green300,
  449. borderActive: colors.green300,
  450. borderTranslucent: colors.green300,
  451. focusBorder: colors.green300,
  452. focusShadow: colors.green200,
  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) => ({
  500. tooltipUnderline: {
  501. textDecoration: `underline dotted ${colors.gray300}`,
  502. textDecorationThickness: '0.75px',
  503. textUnderlineOffset: '1.25px',
  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: ['800px', '992px', '1200px', '1440px', '2560px'],
  516. ...lightColors,
  517. ...lightShadows,
  518. iconSizes,
  519. iconDirections: {
  520. up: '0',
  521. right: '90',
  522. down: '180',
  523. left: '270',
  524. },
  525. // Try to keep these ordered plz
  526. zIndex: {
  527. // Generic z-index when you hope your component is isolated and
  528. // does not need to battle others for z-index priority
  529. initial: 1,
  530. truncationFullValue: 10,
  531. traceView: {
  532. spanTreeToggler: 900,
  533. dividerLine: 909,
  534. rowInfoMessage: 910,
  535. minimapContainer: 999,
  536. },
  537. header: 1000,
  538. errorMessage: 1000,
  539. dropdown: 1001,
  540. dropdownAutocomplete: {
  541. // needs to be below actor but above other page elements (e.g. pagination)
  542. // (e.g. Issue Details "seen" dots on chart is 2)
  543. // stream header is 1000
  544. menu: 1007,
  545. // needs to be above menu
  546. actor: 1008,
  547. },
  548. globalSelectionHeader: 1009,
  549. settingsSidebarNavMask: 1017,
  550. settingsSidebarNav: 1018,
  551. sidebarPanel: 1019,
  552. sidebar: 1020,
  553. orgAndUserMenu: 1030,
  554. // Sentry user feedback modal
  555. sentryErrorEmbed: 1090,
  556. // If you change modal also update shared-components.less
  557. // as the z-index for bootstrap modals lives there.
  558. modal: 10000,
  559. toast: 10001,
  560. // tooltips and hovercards can be inside modals sometimes.
  561. hovercard: 10002,
  562. tooltip: 10003,
  563. // On mobile views org stats dropdowns overlap
  564. orgStats: {
  565. dataCategory: 2,
  566. timeRange: 1,
  567. },
  568. // On mobile views issue list dropdowns overlap
  569. issuesList: {
  570. stickyHeader: 1,
  571. sortOptions: 2,
  572. displayOptions: 3,
  573. },
  574. },
  575. grid: 8,
  576. borderRadius: '4px',
  577. borderRadiusBottom: '0 0 4px 4px',
  578. borderRadiusTop: '4px 4px 0 0',
  579. borderRadiusLeft: '4px 0 0 4px',
  580. borderRadiusRight: '0 4px 4px 0',
  581. headerSelectorRowHeight: 44,
  582. headerSelectorLabelHeight: 28,
  583. // Relative font sizes
  584. fontSizeRelativeSmall: '0.9em',
  585. fontSizeExtraSmall: '11px',
  586. fontSizeSmall: '12px',
  587. fontSizeMedium: '14px',
  588. fontSizeLarge: '16px',
  589. fontSizeExtraLarge: '18px',
  590. headerFontSize: '22px',
  591. settings: {
  592. // Max-width for settings breadcrumbs
  593. // i.e. organization, project, or team
  594. maxCrumbWidth: '240px',
  595. containerWidth: '1440px',
  596. headerHeight: '69px',
  597. sidebarWidth: '220px',
  598. },
  599. sidebar: {
  600. boxShadow: '0 3px 3px #2f2936',
  601. color: '#9586a5',
  602. divider: '#493e54',
  603. badgeSize: '22px',
  604. smallBadgeSize: '11px',
  605. collapsedWidth: '70px',
  606. expandedWidth: '220px',
  607. mobileHeight: '54px',
  608. menuSpacing: '15px',
  609. },
  610. text: {
  611. family: '"Rubik", "Avenir Next", sans-serif',
  612. familyMono: '"Roboto Mono", Monaco, Consolas, "Courier New", monospace',
  613. lineHeightHeading: 1.2,
  614. lineHeightBody: 1.4,
  615. pageTitle: {
  616. fontSize: '1.625rem',
  617. fontWeight: 600,
  618. letterSpacing: '-0.01em',
  619. lineHeight: 1.2,
  620. },
  621. cardTitle: {
  622. fontSize: '1rem',
  623. fontWeight: 600,
  624. lineHeight: 1.2,
  625. },
  626. },
  627. /**
  628. * Common styles for form inputs & buttons, separated by size.
  629. * Should be used to ensure consistent sizing among form elements.
  630. */
  631. form: {
  632. default: {
  633. height: 40,
  634. minHeight: 40,
  635. fontSize: '0.875rem',
  636. lineHeight: '1rem',
  637. },
  638. small: {
  639. height: 34,
  640. minHeight: 34,
  641. fontSize: '0.875rem',
  642. lineHeight: '1rem',
  643. },
  644. xsmall: {
  645. height: 28,
  646. minHeight: 28,
  647. fontSize: '0.75rem',
  648. lineHeight: '0.875rem',
  649. },
  650. },
  651. /**
  652. * Padding for buttons
  653. */
  654. buttonPadding: {
  655. default: {
  656. paddingTop: 10,
  657. paddingBottom: 10,
  658. paddingLeft: 16,
  659. paddingRight: 16,
  660. },
  661. small: {
  662. paddingTop: 8,
  663. paddingBottom: 8,
  664. paddingLeft: 12,
  665. paddingRight: 12,
  666. },
  667. xsmall: {
  668. paddingTop: 6,
  669. paddingBottom: 6,
  670. paddingLeft: 8,
  671. paddingRight: 8,
  672. },
  673. },
  674. dataCategory,
  675. tag: generateTagTheme(lightColors),
  676. level: generateLevelTheme(lightColors),
  677. charts: {
  678. colors: CHART_PALETTE[CHART_PALETTE.length - 1],
  679. // We have an array that maps `number + 1` --> list of `number` colors
  680. getColorPalette: (length: number) =>
  681. CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)] as string[],
  682. previousPeriod: lightColors.gray200,
  683. symbolSize: 6,
  684. },
  685. diff: {
  686. removedRow: 'hsl(358deg 89% 65% / 15%)',
  687. removed: 'hsl(358deg 89% 65% / 30%)',
  688. addedRow: 'hsl(100deg 100% 87% / 18%)',
  689. added: 'hsl(166deg 58% 47% / 32%)',
  690. },
  691. // Similarity spectrum used in "Similar Issues" in group details
  692. similarity: {
  693. empty: '#e2dee6',
  694. colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'],
  695. },
  696. // used as a gradient,
  697. businessIconColors: ['#EA5BC2', '#6148CE'],
  698. demo: {
  699. headerSize: '70px',
  700. },
  701. };
  702. const lightAliases = generateAliases(lightColors);
  703. const darkAliases = generateAliases(darkColors);
  704. export const lightTheme = {
  705. ...commonTheme,
  706. ...lightColors,
  707. ...lightAliases,
  708. ...lightShadows,
  709. inverted: {
  710. ...darkColors,
  711. ...darkAliases,
  712. },
  713. ...generateUtils(lightColors),
  714. alert: generateAlertTheme(lightColors, lightAliases),
  715. badge: generateBadgeTheme(lightColors),
  716. button: generateButtonTheme(lightColors, lightAliases),
  717. tag: generateTagTheme(lightColors),
  718. level: generateLevelTheme(lightColors),
  719. sidebar: {
  720. ...commonTheme.sidebar,
  721. background: sidebarBackground.light,
  722. },
  723. sidebarGradient: `linear-gradient(294.17deg,${sidebarBackground.light} 35.57%,#452650 92.42%,#452650 92.42%)`,
  724. sidebarBorder: 'transparent',
  725. };
  726. export const darkTheme: Theme = {
  727. ...commonTheme,
  728. ...darkColors,
  729. ...darkAliases,
  730. ...darkShadows,
  731. inverted: {
  732. ...lightColors,
  733. ...lightAliases,
  734. },
  735. ...generateUtils(darkColors),
  736. alert: generateAlertTheme(darkColors, darkAliases),
  737. badge: generateBadgeTheme(darkColors),
  738. button: generateButtonTheme(darkColors, darkAliases),
  739. tag: generateTagTheme(darkColors),
  740. level: generateLevelTheme(darkColors),
  741. sidebar: {
  742. ...commonTheme.sidebar,
  743. background: sidebarBackground.dark,
  744. },
  745. sidebarGradient: `linear-gradient(180deg, ${sidebarBackground.dark} 0%, #1B1825 100%)`,
  746. sidebarBorder: darkAliases.border,
  747. };
  748. export type Theme = typeof lightTheme;
  749. export type Aliases = typeof lightAliases;
  750. export type Color = keyof typeof lightColors;
  751. export type IconSize = keyof typeof iconSizes;
  752. export default commonTheme;
  753. type MyTheme = Theme;
  754. /**
  755. * Configure Emotion to use our theme
  756. */
  757. declare module '@emotion/react' {
  758. // eslint-disable-next-line @typescript-eslint/no-shadow
  759. export interface Theme extends MyTheme {}
  760. }
  761. // This should never be used directly (except in storybook)
  762. export {lightAliases as aliases};