Skip to content

Commit f6dee72

Browse files
committed
fix dark mode
1 parent a262bd0 commit f6dee72

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

packages/feedback/src/integration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ export class Feedback implements Integration {
319319
return null;
320320
}
321321

322+
// set data attribute on host for different themes
323+
this._host.dataset.sentryFeedbackColorscheme = options.colorScheme;
324+
322325
const result = cb([this._shadow, this._host]);
323326

324327
if (needsAppendHost) {

packages/feedback/src/widget/Main.css.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export function createMainStyles(
99
themes: FeedbackThemes,
1010
): HTMLStyleElement {
1111
const style = d.createElement('style');
12-
const theme = colorScheme === 'system' ? themes.light : themes[colorScheme];
1312
style.textContent = `
1413
:host {
1514
--bottom: 1rem;
@@ -26,16 +25,17 @@ export function createMainStyles(
2625
2726
z-index: var(--zIndex);
2827
29-
font-family: ${theme.fontFamily};
30-
font-size: ${theme.fontSize};
31-
--bg-color: ${theme.background};
32-
--bg-hover-color: ${theme.backgroundHover};
33-
--fg-color: ${theme.foreground};
34-
--error-color: ${theme.error};
35-
--success-color: ${theme.success};
36-
--border: ${theme.border};
37-
--box-shadow: ${theme.boxShadow};
28+
font-family: ${themes.light.fontFamily};
29+
font-size: ${themes.light.fontSize};
30+
--bg-color: ${themes.light.background};
31+
--bg-hover-color: ${themes.light.backgroundHover};
32+
--fg-color: ${themes.light.foreground};
33+
--error-color: ${themes.light.error};
34+
--success-color: ${themes.light.success};
35+
--border: ${themes.light.border};
36+
--box-shadow: ${themes.light.boxShadow};
3837
}
38+
3939
${
4040
colorScheme === 'system'
4141
? `
@@ -51,7 +51,19 @@ ${
5151
}
5252
}
5353
`
54-
: ''
54+
: `
55+
:host-context([data-sentry-feedback-colorscheme="dark"]) {
56+
font-family: ${themes.dark.fontFamily};
57+
font-size: ${themes.dark.fontSize};
58+
--bg-color: ${themes.dark.background};
59+
--bg-hover-color: ${themes.dark.backgroundHover};
60+
--fg-color: ${themes.dark.foreground};
61+
--error-color: ${themes.dark.error};
62+
--success-color: ${themes.dark.success};
63+
--border: ${themes.dark.border};
64+
--box-shadow: ${themes.dark.boxShadow};
65+
}
66+
`
5567
}`;
5668

5769
return style;

0 commit comments

Comments
 (0)