MCPcopy Create free account
hub / github.com/codeaashu/claude-code / render

Method render

src/native-ts/color-diff/index.ts:944–967  ·  view source on GitHub ↗
(themeName: string, width: number, dim: boolean)

Source from the content-addressed store, hash-verified

942 }
943
944 render(themeName: string, width: number, dim: boolean): string[] | null {
945 const mode = detectColorMode(themeName)
946 const theme = buildTheme(themeName, mode)
947 const lines = this.code.split('\n')
948 // Rust .lines() drops trailing empty line from trailing \n
949 if (lines.length > 0 && lines[lines.length - 1] === '') lines.pop()
950 const firstLine = lines[0] ?? null
951 const lang = detectLanguage(this.filePath, firstLine)
952 const hlState = { lang, stack: null }
953
954 const maxDigits = String(lines.length).length
955 const effectiveWidth = Math.max(1, width - maxDigits - 2)
956
957 const out: string[] = []
958 for (let i = 0; i < lines.length; i++) {
959 const tokens = highlightLine(hlState, lines[i]!, theme)
960 const h: Highlight = { marker: null, lineNumber: i + 1, lines: [tokens] }
961 removeNewlines(h)
962 wrapText(h, effectiveWidth, theme)
963 addLineNumber(h, theme, maxDigits, dim)
964 out.push(...intoLines(h, dim, true, mode))
965 }
966 return out
967 }
968}
969
970export function getSyntaxTheme(themeName: string): SyntaxTheme {

Callers

nothing calls this directly

Calls 11

detectColorModeFunction · 0.85
buildThemeFunction · 0.85
highlightLineFunction · 0.85
removeNewlinesFunction · 0.85
addLineNumberFunction · 0.85
intoLinesFunction · 0.85
popMethod · 0.80
maxMethod · 0.80
detectLanguageFunction · 0.70
wrapTextFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected