var prompt = require('..')
  , sets = prompt.sets
  , definitions = sets.definitions
  , ansi = require('ttycolor').ansi;

var repeat = require('cli-util').repeat;
var wrap = require('cli-util').wrap;
var delim = repeat(80, '+');

var available = Object.keys(ansi.codes.colors).concat(
  Object.keys(ansi.codes.attrs));

/**
 *  Use ANSI escape sequences.
 */

console.log('ansi: send SIGINT (Ctrl^C) to exit');
console.log(delim);
console.info('%s', wrap(available.join(', '), 0, 80));
console.log(delim);

var color = 'cyan';

var colors = {
  name: function(v) {
    return ansi(v)[color].valueOf(true)
  },
  delimiter: function(v) {
    return ansi(v).cyan.valueOf(true)
  },
  parameters: function(a) {
    return a.slice(0).map(function(v) {
      if(!v) return v;
      return ansi(v)[color].bright.valueOf(true);
    })
  }
}

var type = definitions.question.clone(
  {key: 'color', message: 'enter a %s name:', parameters: ['color']});

color.required = true;
color.repeat = true;

var set = [type];
var ps = prompt({infinite: true, colors: colors});
ps.run(set, function(err, res) {
  if(err) console.error(err);
  if(res && res.map) {
    if(!~available.indexOf(res.map.color)) {
      return console.error(
        'error: unknown color attribute name "%s"', res.map.color);
    }
    color = res.map.color;
  }
});

@@ -117,21 +117,18 @@
 ansi
-;%0A%0Avar repeat
+%0A  , utils
  = r
@@ -149,28 +149,46 @@
 il')
+%0A  , repeat = utils
 .repeat
-;%0Avar
+%0A  ,
  wrap = 
 requ
@@ -187,34 +187,61 @@
 p = 
-require('cli-
 util
-')
+s
 .wrap;%0A
+%0A/**%0A *  Use ANSI escape sequences.%0A */%0A%0A
 var 
@@ -265,17 +265,16 @@
 , '+');%0A
-%0A
 var avai
@@ -359,48 +359,8 @@
 );%0A%0A
-/**%0A *  Use ANSI escape sequences.%0A */%0A%0A
 cons
@@ -872,16 +872,21 @@
 one(%0A  %7B
+%0A    
 key: 'co
@@ -890,16 +890,20 @@
 'color',
+%0A   
  message
@@ -923,16 +923,20 @@
  name:',
+%0A   
  paramet
@@ -953,27 +953,22 @@
 or'%5D
-%7D);%0A%0Acolor.
+,%0A    
 required
  = t
@@ -967,36 +967,38 @@
 ired
- =
+:
  true
-;%0Acolor.
+,%0A    
 repeat
- =
+:
  true
+%0A  %7D%0A)
 ;%0A%0Av

Update ansi example.