/**
 * This file is a little program that prints all of the colors to the console
 */ import { Colors , IColorableSequence } from '../../index' ; export function createColorGrid ( attributeFunction ? ) { const foregroundFunctions = [ ( text ) => Colors . _normalizeStringOrColorableSequence ( text ) , Colors . black , Colors . white , Colors . gray , Colors . magenta , Colors . red , Colors . yellow , Colors . green , Colors . cyan , Colors . blue ] ; const backgroundFunctions = [ ( text ) => Colors . _normalizeStringOrColorableSequence ( text ) , Colors . blackBackground , Colors . whiteBackground , Colors . grayBackground , Colors . magentaBackground , Colors . redBackground , Colors . yellowBackground , Colors . greenBackground , Colors . cyanBackground , Colors . blueBackground ] ; const lines = [ ] ; for ( const backgroundFunction of backgroundFunctions ) { const sequences = [ ] ; for ( const foregroundFunction of foregroundFunctions ) { let sequence = backgroundFunction ( foregroundFunction ( 'X' ) ) ; if ( attributeFunction ) { sequence = attributeFunction ( sequence ) ; } sequences . push ( sequence ) ; } lines . push ( sequences ) ; } return lines ; }