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

Method render

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected