MCPcopy Create free account
hub / github.com/modem-dev/hunk / stackCellPalette

Function stackCellPalette

src/ui/diff/rowStyle.ts:111–140  ·  view source on GitHub ↗
(
  kind: StackLineCell["kind"],
  theme: AppTheme,
  moveKind?: StackLineCell["moveKind"],
)

Source from the content-addressed store, hash-verified

109
110/** Pick stack-view colors from the semantic diff cell kind. */
111export function stackCellPalette(
112 kind: StackLineCell["kind"],
113 theme: AppTheme,
114 moveKind?: StackLineCell["moveKind"],
115) {
116 if (kind === "addition") {
117 return {
118 gutterBg: moveKind ? theme.movedAddedBg : theme.addedBg,
119 contentBg: moveKind ? theme.movedAddedBg : theme.addedBg,
120 signColor: theme.addedSignColor,
121 numberColor: theme.addedSignColor,
122 };
123 }
124
125 if (kind === "deletion") {
126 return {
127 gutterBg: moveKind ? theme.movedRemovedBg : theme.removedBg,
128 contentBg: moveKind ? theme.movedRemovedBg : theme.removedBg,
129 signColor: theme.removedSignColor,
130 numberColor: theme.removedSignColor,
131 };
132 }
133
134 return {
135 gutterBg: theme.lineNumberBg,
136 contentBg: theme.contextBg,
137 signColor: theme.muted,
138 numberColor: theme.lineNumberFg,
139 };
140}
141
142/** Format one optional line number for a fixed-width diff gutter. */
143export function diffLineNumberText(value: number | undefined, width: number) {

Callers 4

renderStaticStackRowFunction · 0.90
pierre.test.tsFile · 0.90
buildWrappedStackCellFunction · 0.90
renderStackCellFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected