MCPcopy
hub / github.com/jestjs/jest / getReceivedColorForChalkInstance

Function getReceivedColorForChalkInstance

packages/jest-snapshot/src/printSnapshot.ts:67–83  ·  view source on GitHub ↗
(
  chalkInstance: Chalk,
)

Source from the content-addressed store, hash-verified

65};
66
67export const getReceivedColorForChalkInstance = (
68 chalkInstance: Chalk,
69): DiffOptionsColor => {
70 const level = chalkInstance.level;
71
72 if (level === 3) {
73 return chalkInstance
74 .rgb(bForeground3[0], bForeground3[1], bForeground3[2])
75 .bgRgb(bBackground3[0], bBackground3[1], bBackground3[2]);
76 }
77
78 if (level === 2) {
79 return chalkInstance.ansi256(bForeground2).bgAnsi256(bBackground2);
80 }
81
82 return chalkInstance.cyan.bgWhiteBright; // also known as teal
83};
84
85export const aSnapshotColor = getSnapshotColorForChalkInstance(chalk);
86export const bReceivedColor = getReceivedColorForChalkInstance(chalk);

Callers 2

formatLinesFunction · 0.90
printSnapshot.tsFile · 0.85

Calls

no outgoing calls

Tested by 1

formatLinesFunction · 0.72