( kind: StackLineCell["kind"], theme: AppTheme, moveKind?: StackLineCell["moveKind"], )
| 109 | |
| 110 | /** Pick stack-view colors from the semantic diff cell kind. */ |
| 111 | export 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. */ |
| 143 | export function diffLineNumberText(value: number | undefined, width: number) { |
no outgoing calls
no test coverage detected