Permalink
Browse files

[docs] added the colors parameter explanation

  • Loading branch information...
1 parent 48df3c1 commit b82d89cbbba856f2131976db88836ddd8a20009e nicoreed committed Jun 20, 2011
Showing with 38 additions and 0 deletions.
  1. +26 −0 README.md
  2. +12 −0 examples/put-rows-colors.js
View
@@ -139,6 +139,32 @@ Takes a set of Objects and the properties to extract from them and it will log t
data: 0.14310582634061575 bazz 1234 Nowhere Dr.
data: 0.4638693502638489 bazz 1234 Nowhere Dr.
```
+**Colors Parameter**
+The `colors` parameter is an array that colors the first row. It uses the [colors.js][2]. You can use any of those.
+
+``` js
+ var cliff = require('../lib/cliff');
+
+ var rows = [
+ ['Name', 'Flavor', 'Dessert'],
+ ['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow],
+ ['Bob', 'carmel', 'apples'],
+ ['Joe', 'chocolate', 'cake'],
+ ['Nick', 'vanilla', 'ice cream']
+ ];
+
+ cliff.putRows('data', rows, ['red', 'blue', 'green']);
+```
+
+The resulting output on the command-line would be (except it would be super colorful):
+``` bash
+$ node examples/put-rows-colors.js
+data: Name Flavor Dessert
+data: Alice cherry yogurt
+data: Bob carmel apples
+data: Joe chocolate cake
+data: Nick vanilla ice cream
+```
## Run Tests
All of the cliff tests are written in [vows][4], and cover all of the use cases described above.
@@ -0,0 +1,12 @@
+var cliff = require('../lib/cliff');
+
+var rows = [
+ ['Name', 'Flavor', 'Dessert'],
+ ['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow],
+ ['Bob', 'carmel', 'apples'],
+ ['Joe', 'chocolate', 'cake'],
+ ['Nick', 'vanilla', 'ice cream']
+];
+
+cliff.putRows('data', rows, ['red', 'blue', 'green']);
+

0 comments on commit b82d89c

Please sign in to comment.