Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

browserify example works but the colors are a bit close

  • Loading branch information...
commit dfb06c1e6e7fa93bbb2e38d4960bfc6eb157cdbb 1 parent cee5489
James Halliday substack authored
5 README.markdown
Source Rendered
... ... @@ -1,2 +1,7 @@
1 1 Mr. Color
2 2 =========
  3 +
  4 +I just want some colors, you know?
  5 +
  6 +This module gives you some colors which are all different but they get less
  7 +different the more you want.
12 example/browser/index.html
... ... @@ -0,0 +1,12 @@
  1 +<html>
  2 + <head>
  3 + <title>Mr. Color, requisition me some colors post haste!</title>
  4 + <script type="text/javascript" src="/browserify.js"></script>
  5 + </head>
  6 + <body>
  7 + <div>
  8 + <input id="clicky" type="button" value="more colors!">
  9 + </div>
  10 + <div id="colors"></div>
  11 + </body>
  12 +</html>
22 example/browser/main.js
... ... @@ -0,0 +1,22 @@
  1 +var mr = require('mrcolor');
  2 +var $ = require('jquery-browserify');
  3 +
  4 +$(window).ready(function () {
  5 + var color = mr();
  6 +
  7 + $('#clicky').click(function () {
  8 + var rgb = 'rgb(' + color.rgb().join(',') + ')';
  9 + color = color.next();
  10 +
  11 + $('<div>')
  12 + .css({
  13 + 'background-color' : rgb,
  14 + color : 'white',
  15 + width : 500,
  16 + height : 30
  17 + })
  18 + .text(rgb)
  19 + .appendTo($('#colors'))
  20 + ;
  21 + });
  22 +});
10 example/browser/server.js
... ... @@ -0,0 +1,10 @@
  1 +var express = require('express');
  2 +var app = express.createServer();
  3 +app.use(express.static(__dirname));
  4 +
  5 +var browserify = require('browserify');
  6 +var bundle = browserify({ entry : __dirname + '/main.js' });
  7 +app.use(bundle);
  8 +
  9 +app.listen(8080);
  10 +console.log('Listening on :8080');
4 package.json
@@ -12,7 +12,9 @@
12 12 "color-convert" : "0.2.x"
13 13 },
14 14 "devDependencies" : {
15   - "expresso" : "0.7.x"
  15 + "expresso" : "0.7.x",
  16 + "jquery-browserify" : "1.6.x",
  17 + "browserify" : ">=1.2.8 <1.3"
16 18 },
17 19 "scripts" : {
18 20 "test" : "expresso"

0 comments on commit dfb06c1

Please sign in to comment.
Something went wrong with that request. Please try again.