Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 81 lines (35 sloc) 1.405 kb
3b9e9f85 »
2012-01-19 changed ColorHash to match API of jquery.colorhash
1 jquery.colorhash.js
2 ===================
b267c1b1 »
2012-01-19 a very basic jQuery plugin
3
4 A jQuery plugin to set the background color of any element depending on its value or text.
5
433bd4af »
2012-01-19 extended functionality of jQuery plugin
6 Basic usage:
b267c1b1 »
2012-01-19 a very basic jQuery plugin
7
8 $("input").colorHash();
9 $("p").colorHash();
10
11 Sets the text color to black or white to contrast the background color.
433bd4af »
2012-01-19 extended functionality of jQuery plugin
12
13
14
15 Advanced usage:
16
17 Get the color without setting it:
18
19 $("input").colorHash("color");
20
21
22 Add a custom color scheme
23
24 $.fn.colorHash("scheme", "blackAndWhite", ["000000", "ffffff"]);
25
26
27 Set the color based on a custom color scheme:
28
29 $("input").colorHash("blackAndWhite");
30
31
32 Get the hash of an element's text or value:
33
34 $("input").colorHash("hash");
35
36
37 Get a color scheme:
38
39 $.fn.colorHash("scheme", "blackAndWhite");
40
41
42 Delete a color scheme:
43
44 $.fn.colorHash("scheme", "blackAndWhite", "delete");
3b9e9f85 »
2012-01-19 changed ColorHash to match API of jquery.colorhash
45
46
47
48 ColorHash.js
49 ============
50
51 A standalone version to get a color hash from a string.
52
53
54 Basic usage:
55
56 ColorHash.getColor("Roses are red, violets are blue.");
57
58
59 Add a custom color scheme
60
61 ColorHash.addScheme("blackAndWhite", ["000000", "ffffff"]);
62
63
64 Get the color based on a custom color scheme:
65
66 ColorHash.getColor("Most poems rhyme", "blackAndWhite");
67
68
69 Get the hash of a string:
70
71 ColorHash.getHash("This one doesn't.");
72
73
74 Get a color scheme:
75
76 ColorHash.getScheme("blackAndWhite");
77
78
79 Delete a color scheme:
80
81 ColorHash.deleteScheme("blackAndWhite");
82
Something went wrong with that request. Please try again.