@cowwoc/requirements
Version:
A fluent API for enforcing design contracts with automatic message generation.
35 lines • 1.34 kB
JavaScript
/**
* The encodings supported by the terminal.
*/
var TerminalEncoding;
(function (TerminalEncoding) {
/**
* A terminal that does not support any colors.
*/
TerminalEncoding[TerminalEncoding["NONE"] = 0] = "NONE";
/**
* Node terminal supports a 16-color palette.
*/
TerminalEncoding[TerminalEncoding["NODE_16_COLORS"] = 1] = "NODE_16_COLORS";
/**
* Node terminal supports a 256-color palette.
*/
TerminalEncoding[TerminalEncoding["NODE_256_COLORS"] = 2] = "NODE_256_COLORS";
/**
* Node terminal supports a 24-bit color palette.
*/
TerminalEncoding[TerminalEncoding["NODE_16MILLION_COLORS"] = 3] = "NODE_16MILLION_COLORS";
})(TerminalEncoding || (TerminalEncoding = {}));
/**
* Returns a comparator that sorts encodings based on the number of colors that they support, from the most
* to the least number of colors.
*
* @param first - the first encoding
* @param second - the second encoding
* @returns a negative number if `first` supports more colors than `second`.
* `0` if the encodings support the same number of colors. A positive number if
* `first` supports fewer colors than `second`.
*/
const sortByDecreasingRank = (first, second) => second - first;
export { TerminalEncoding, sortByDecreasingRank };
//# sourceMappingURL=TerminalEncoding.mjs.map