1
1
import type { FeedbackInternalOptions } from '@sentry/types' ;
2
2
import { DOCUMENT } from '../constants' ;
3
3
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 {
5
37
return `
6
38
--foreground: ${ theme . foreground } ;
7
- --success-foreground: ${ theme . successForeground } ;
8
- --error-foreground: ${ theme . errorForeground } ;
9
39
--background: ${ theme . background } ;
40
+ --accent-foreground: ${ theme . accentForeground } ;
41
+ --accent-background: ${ theme . accentBackground } ;
42
+ --success-color: ${ theme . successColor } ;
43
+ --error-color: ${ theme . errorColor } ;
10
44
--border: ${ theme . border } ;
11
45
--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 } ;
23
48
` ;
24
49
}
25
50
@@ -41,15 +66,17 @@ export function createMainStyles({ colorScheme, themeDark, themeLight }: Feedbac
41
66
font-family: var(--font-family);
42
67
font-size: var(--font-size);
43
68
44
- ${ getThemedCssVariables ( colorScheme === 'dark' ? themeDark : themeLight ) }
69
+ ${ getThemedCssVariables (
70
+ colorScheme === 'dark' ? { ...DEFAULT_DARK , ...themeDark } : { ...DEFAULT_LIGHT , ...themeLight } ,
71
+ ) }
45
72
}
46
73
47
74
${
48
75
colorScheme === 'system'
49
76
? `
50
77
@media (prefers-color-scheme: dark) {
51
78
:host {
52
- ${ getThemedCssVariables ( themeDark ) }
79
+ ${ getThemedCssVariables ( { ... DEFAULT_DARK , ... themeDark } ) }
53
80
}
54
81
}`
55
82
: ''
0 commit comments