@@ -58,7 +58,7 @@ const TEXT_VERY_MUTED = 'rgba(30, 20, 40, 0.4)';
5858const ACCENT_COLOR = 'rgb(70, 120, 190)' ;
5959const FOOTER_BG = 'rgb(54, 59, 64)' ;
6060const FOOTER_FG = 'rgb(255, 255, 255)' ;
61- const CODE_BG = 'rgba(0, 0, 0 , 0.06 )' ;
61+ const INLINE_CODE_COLOR = 'rgba(30, 20, 40 , 0.72 )' ;
6262const CODE_BLOCK_BG = 'rgba(0, 0, 0, 0.05)' ;
6363const CODE_BLOCK_BORDER = 'rgba(0, 0, 0, 0.08)' ;
6464const HR_COLOR = 'rgba(0, 0, 0, 0.12)' ;
@@ -73,8 +73,8 @@ const SYN_COMMENT = 'rgba(30, 20, 40, 0.45)';
7373const SYN_NUMBER = 'rgb(180, 100, 30)' ;
7474const SYN_FUNCTION = 'rgb(70, 100, 180)' ;
7575
76- type RunStyle = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'code' | 'link'
77- | 'strike' ;
76+ type RunStyle = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'code'
77+ | 'inline-code' | 'link' | ' strike';
7878interface TextRun {
7979 text : string ;
8080 style : RunStyle ;
@@ -141,7 +141,7 @@ function tokensToRuns(
141141 out . push ( ...tokensToRuns ( tk . tokens , 'strike' ) ) ;
142142 break ;
143143 case 'codespan' :
144- out . push ( { text : decodeEntities ( tk . text || '' ) , style : 'code' } ) ;
144+ out . push ( { text : decodeEntities ( tk . text || '' ) , style : 'inline- code' } ) ;
145145 break ;
146146 case 'link' :
147147 if ( tk . tokens && tk . tokens . length > 0 ) {
@@ -175,6 +175,7 @@ function tokensToRuns(
175175
176176function mergeStyle ( a : RunStyle , b : RunStyle ) : RunStyle {
177177 if ( a === 'code' || b === 'code' ) return 'code' ;
178+ if ( a === 'inline-code' || b === 'inline-code' ) return 'inline-code' ;
178179 if ( a === 'link' || b === 'link' ) return 'link' ;
179180 const isBold = a === 'bold' || a === 'bold-italic' || b === 'bold' ||
180181 b === 'bold-italic' ;
@@ -206,6 +207,7 @@ function fontFor(style: RunStyle, sizePx: number, weight?: number): string {
206207 case 'bold-italic' :
207208 return `italic ${ weight ?? 600 } ${ sizePx } px ${ FONT_FAMILY } ` ;
208209 case 'code' :
210+ case 'inline-code' :
209211 return `${ sizePx - 2 } px ${ MONO_FAMILY } ` ;
210212 case 'strike' :
211213 case 'link' :
@@ -278,11 +280,17 @@ function paintLine(
278280 for ( const run of line . runs ) {
279281 g . font = fontFor ( run . style , sizePx , weight ) ;
280282 const w = g . measureText ( run . text ) . width ;
281- if ( run . style === 'code' ) {
282- g . fillStyle = CODE_BG ;
283- paintRoundedRect ( g , cursorX - 2 , y - sizePx + 2 , w + 4 , sizePx + 2 , 4 ) ;
284- }
285- g . fillStyle = run . color || ( run . style === 'link' ? ACCENT_COLOR : color ) ;
283+ // Inline code: the prior CODE_BG pill visually read as a text-selection
284+ // highlight against the light surface. Distinguish code via the
285+ // monospace font + a muted tint instead. White-on-blue bubbles keep
286+ // their bubble text color so code stays legible on accent. Code blocks
287+ // (style 'code', set by syntaxRuns) keep their syntax-tinted palette.
288+ g . fillStyle = run . color ||
289+ ( run . style === 'link' ?
290+ ACCENT_COLOR :
291+ ( run . style === 'inline-code' && color === TEXT_COLOR ?
292+ INLINE_CODE_COLOR :
293+ color ) ) ;
286294 g . textBaseline = 'alphabetic' ;
287295 g . fillText ( run . text , cursorX , y ) ;
288296 if ( run . style === 'strike' ) {
0 commit comments