Meta tweaks

This commit is contained in:
Sindre Sorhus 2022-10-04 21:22:40 +07:00
parent c2311622c3
commit 96f44c976b
5 changed files with 26 additions and 19 deletions

View file

@ -105,7 +105,7 @@ function assembleStyles() {
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
Object.defineProperties(styles, {
rgbToAnsi256: {
value: (red, green, blue) => {
value(red, green, blue) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (red === green && green === blue) {
@ -128,7 +128,7 @@ function assembleStyles() {
enumerable: false,
},
hexToRgb: {
value: hex => {
value(hex) {
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
@ -157,7 +157,7 @@ function assembleStyles() {
enumerable: false,
},
ansi256ToAnsi: {
value: code => {
value(code) {
if (code < 8) {
return 30 + code;
}