theme.tsx 20 KB

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