11import type { FeedbackInternalOptions } from '@sentry/types' ;
22import { DOCUMENT } from '../constants' ;
33
4- function getThemedCssVariables ( theme : FeedbackInternalOptions [ 'themeLight' ] ) : string {
4+ const PURPLE = 'rgba(88, 74, 192, 1)' ;
5+
6+ interface InternalTheme extends NonNullable < FeedbackInternalOptions [ 'themeLight' ] > {
7+ border : string ;
8+ interactiveFilter : string ;
9+ }
10+
11+ const DEFAULT_LIGHT : InternalTheme = {
12+ foreground : '#2b2233' ,
13+ background : '#ffffff' ,
14+ accentForeground : 'white' ,
15+ accentBackground : PURPLE ,
16+ successColor : '#268d75' ,
17+ errorColor : '#df3338' ,
18+ border : '1.5px solid rgba(41, 35, 47, 0.13)' ,
19+ boxShadow : '0px 4px 24px 0px rgba(43, 34, 51, 0.12)' ,
20+ outline : '1px auto var(--accent-background)' ,
21+ interactiveFilter : 'brightness(95%)' ,
22+ } ;
23+ const DEFAULT_DARK : InternalTheme = {
24+ foreground : '#ebe6ef' ,
25+ background : '#29232f' ,
26+ accentForeground : 'white' ,
27+ accentBackground : PURPLE ,
28+ successColor : '#2da98c' ,
29+ errorColor : '#f55459' ,
30+ border : '1.5px solid rgba(41, 35, 47, 0.5)' ,
31+ boxShadow : '0px 4px 24px 0px rgba(43, 34, 51, 0.12)' ,
32+ outline : '1px auto var(--accent-background)' ,
33+ interactiveFilter : 'brightness(150%)' ,
34+ } ;
35+
36+ function getThemedCssVariables ( theme : InternalTheme ) : string {
537 return `
638 --foreground: ${ theme . foreground } ;
7- --success-foreground: ${ theme . successForeground } ;
8- --error-foreground: ${ theme . errorForeground } ;
939 --background: ${ theme . background } ;
40+ --accent-foreground: ${ theme . accentForeground } ;
41+ --accent-background: ${ theme . accentBackground } ;
42+ --success-color: ${ theme . successColor } ;
43+ --error-color: ${ theme . errorColor } ;
1044 --border: ${ theme . border } ;
1145 --box-shadow: ${ theme . boxShadow } ;
12-
13- --button-foreground: ${ theme . buttonForeground } ;
14- --button-foreground-hover: ${ theme . buttonForegroundHover } ;
15- --button-background: ${ theme . buttonBackground } ;
16- --button-background-hover: ${ theme . buttonBackgroundHover } ;
17- --button-border: ${ theme . buttonBorder } ;
18- --button-outline-focus: ${ theme . buttonOutlineFocus } ;
19-
20- --trigger-background: ${ theme . triggerBackground } ;
21- --trigger-background-hover: ${ theme . triggerBackgroundHover } ;
22- --trigger-border-radius: ${ theme . triggerBorderRadius } ;
46+ --outline: ${ theme . outline } ;
47+ --interactive-filter: ${ theme . interactiveFilter } ;
2348 ` ;
2449}
2550
@@ -41,15 +66,17 @@ export function createMainStyles({ colorScheme, themeDark, themeLight }: Feedbac
4166 font-family: var(--font-family);
4267 font-size: var(--font-size);
4368
44- ${ getThemedCssVariables ( colorScheme === 'dark' ? themeDark : themeLight ) }
69+ ${ getThemedCssVariables (
70+ colorScheme === 'dark' ? { ...DEFAULT_DARK , ...themeDark } : { ...DEFAULT_LIGHT , ...themeLight } ,
71+ ) }
4572}
4673
4774${
4875 colorScheme === 'system'
4976 ? `
5077@media (prefers-color-scheme: dark) {
5178 :host {
52- ${ getThemedCssVariables ( themeDark ) }
79+ ${ getThemedCssVariables ( { ... DEFAULT_DARK , ... themeDark } ) }
5380 }
5481}`
5582 : ''
0 commit comments