theme.tsx 21 KB

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