How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import styles from 'ansi-styles';
    
    styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code
    styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code
    
    styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code
    styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code
    
    styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code
    styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code
    Docs
  • import styles from 'ansi-styles';
    
    console.log(`${styles.green.open}Hello world!${styles.green.close}`);
    
    
    // Color conversion between 256/truecolor
    // NOTE: When converting from truecolor to 256 colors, the original color
    //       may be degraded to fit the new color palette. This means terminals
    //       that do not support 16 million colors will best-match the
    //       original color.
    console.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`)
    console.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`)
    console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`)
    Docs
  • function rgba(hex, opacity) {
      return color(hex).alpha(opacity).rgb().string();
    }
    
    
    /lonelyplanet/backpack-ui mit
  • //...
    /**
     * Convert an array of [r, g, b] numbers to a hex color.
     * @param {number[]} rgbArray The color [r, g, b] array.
     * @returns {string} The hex color as a string.
     */
    export function colorArrayToString(rgbArray) {
      return tinycolor({ r: rgbArray[0], g: rgbArray[1], b: rgbArray[2] }).toHexString();
    }
    
    /**
     * Convert a string color representation to an array of [r,g,b].
     * @param {string} colorString The color as a string.
     * @returns {number[]} The color as an array.
     */
    
    //...
    
    /vitessce/vitessce mit
  • import rgbHex from 'rgb-hex';
    
    rgbHex(65, 131, 196);
    //=> '4183c4'
    
    rgbHex('rgb(40, 42, 54)');
    //=> '282a36'
    
    rgbHex(65, 131, 196, 0.2);
    //=> '4183c433'
    
    rgbHex(40, 42, 54, '75%');
    //=> '282a36bf'
    
    rgbHex('rgba(40, 42, 54, 75%)');
    //=> '282a36bf'
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples