Skip to content

Commit c85bfa9

Browse files
committed
refactor(chat): don't hardcode code background
1 parent 67e19bb commit c85bfa9

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/components/chat/extras/markdown-renderer.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import type { IgcChatMessage } from '../types.js';
77

88
const DEFAULT_LANGUAGES = ['javascript', 'typescript', 'html', 'css'];
99
const DEFAULT_THEME = {
10-
light: 'github-light',
11-
dark: 'github-dark',
10+
light: 'min-light',
11+
dark: 'min-dark',
1212
};
1313

1414
/**
@@ -83,8 +83,16 @@ export async function createMarkdownRenderer(
8383
lang,
8484
themes,
8585
colorReplacements: {
86-
'github-light': colorReplacements,
87-
'github-dark': colorReplacements,
86+
'github-light': {
87+
...colorReplacements,
88+
'#fff': 'var(--shiki-bg)',
89+
'#24292e': 'var(--shiki-fg)',
90+
},
91+
'github-dark': {
92+
...colorReplacements,
93+
'#24292e': 'var(--shiki-bg)',
94+
'#e1e4e8': 'var(--shiki-fg)',
95+
},
8896
},
8997
defaultColor: 'light-dark()',
9098
});

src/components/chat/themes/shared/chat-message/chat-message.common.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33

44
$theme: $material;
55

6+
:host {
7+
--shiki-bg: #{var-get($theme, 'code-background')};
8+
}
9+
610
[part~='sent'] {
711
background: var-get($theme, 'message-background');
812
}
913

1014
[part~='message-container'] {
1115
color: var-get($theme, 'message-color');
1216

13-
// override shiki styles
1417
pre.shiki {
15-
background-color: var-get($theme, 'code-background') !important;
1618
border: rem(1px) solid var-get($theme, 'code-border');
1719
}
1820
}

0 commit comments

Comments
 (0)