MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / applyDefaultStyle

Method applyDefaultStyle

packages/pi-tui/src/components/markdown.ts:250–277  ·  view source on GitHub ↗

* Apply default text style to a string. * This is the base styling applied to all text content. * NOTE: Background color is NOT applied here - it's applied at the padding stage * to ensure it extends to the full line width.

(text: string)

Source from the content-addressed store, hash-verified

248 * to ensure it extends to the full line width.
249 */
250 private applyDefaultStyle(text: string): string {
251 if (!this.defaultTextStyle) {
252 return text;
253 }
254
255 let styled = text;
256
257 // Apply foreground color (NOT background - that's applied at padding stage)
258 if (this.defaultTextStyle.color) {
259 styled = this.defaultTextStyle.color(styled);
260 }
261
262 // Apply text decorations using this.theme
263 if (this.defaultTextStyle.bold) {
264 styled = this.theme.bold(styled);
265 }
266 if (this.defaultTextStyle.italic) {
267 styled = this.theme.italic(styled);
268 }
269 if (this.defaultTextStyle.strikethrough) {
270 styled = this.theme.strikethrough(styled);
271 }
272 if (this.defaultTextStyle.underline) {
273 styled = this.theme.underline(styled);
274 }
275
276 return styled;
277 }
278
279 private getDefaultStylePrefix(): string {
280 if (!this.defaultTextStyle) {

Callers 2

renderTokenMethod · 0.95

Calls 5

colorMethod · 0.80
boldMethod · 0.80
italicMethod · 0.80
strikethroughMethod · 0.80
underlineMethod · 0.80

Tested by

no test coverage detected