()
| 65464 | bgCyanBright: [106, 49], |
| 65465 | bgWhiteBright: [107, 49] |
| 65466 | } |
| 65467 | }; |
| 65468 | var modifierNames = Object.keys(styles.modifier); |
| 65469 | var foregroundColorNames = Object.keys(styles.color); |
| 65470 | var backgroundColorNames = Object.keys(styles.bgColor); |
| 65471 | var colorNames = [...foregroundColorNames, ...backgroundColorNames]; |
| 65472 | function assembleStyles() { |
| 65473 | const codes = /* @__PURE__ */ new Map(); |
| 65474 | for (const [groupName, group] of Object.entries(styles)) { |
| 65475 | for (const [styleName, style] of Object.entries(group)) { |
| 65476 | styles[styleName] = { |
| 65477 | open: `\x1B[${style[0]}m`, |
| 65478 | close: `\x1B[${style[1]}m` |
| 65479 | }; |
| 65480 | group[styleName] = styles[styleName]; |
| 65481 | codes.set(style[0], style[1]); |
| 65482 | } |
| 65483 | Object.defineProperty(styles, groupName, { |
| 65484 | value: group, |
| 65485 | enumerable: false |
| 65486 | }); |
| 65487 | } |
| 65488 | Object.defineProperty(styles, "codes", { |
| 65489 | value: codes, |
| 65490 | enumerable: false |
| 65491 | }); |
| 65492 | styles.color.close = "\x1B[39m"; |
| 65493 | styles.bgColor.close = "\x1B[49m"; |
| 65494 | styles.color.ansi = wrapAnsi16(); |
| 65495 | styles.color.ansi256 = wrapAnsi256(); |
| 65496 | styles.color.ansi16m = wrapAnsi16m(); |
| 65497 | styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); |
| 65498 | styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); |
| 65499 | styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); |
| 65500 | Object.defineProperties(styles, { |
| 65501 | rgbToAnsi256: { |
| 65502 | value(red, green, blue) { |
| 65503 | if (red === green && green === blue) { |
| 65504 | if (red < 8) { |
| 65505 | return 16; |
| 65506 | } |
| 65507 | if (red > 248) { |
| 65508 | return 231; |
| 65509 | } |
| 65510 | return Math.round((red - 8) / 247 * 24) + 232; |
| 65511 | } |
| 65512 | return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5); |
| 65513 | }, |
| 65514 | enumerable: false |
| 65515 | }, |
| 65516 | hexToRgb: { |
| 65517 | value(hex) { |
| 65518 | const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); |
| 65519 | if (!matches) { |
| 65520 | return [0, 0, 0]; |
| 65521 | } |
| 65522 | let [colorString] = matches; |
| 65523 | if (colorString.length === 3) { |
no test coverage detected
searching dependent graphs…