From fd2ea0c6aeab0dbd26b4d43de2818c9af2aa729d Mon Sep 17 00:00:00 2001 From: azurylattice Date: Fri, 4 Mar 2016 20:18:49 -0800 Subject: [PATCH 01/11] add rgb-alpha --- src/Please.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Please.js b/src/Please.js index 20e7edd..4bb2a20 100644 --- a/src/Please.js +++ b/src/Please.js @@ -177,12 +177,14 @@ full_random: false, colors_returned: 1, format: 'hex', - seed: null + seed: null, + }; var make_scheme_default = { scheme_type: 'analogous', format: 'hex' + alpha: 1.0 // default to opaque }; var make_contrast_default = { @@ -233,6 +235,17 @@ raw_rgb.b + ")"; } break; + case 'rgb-alpha': + for ( i = 0; i < array.length; i++ ) { + var raw_rgb = Please.HSV_to_RGB( array[i] ); + array[i] = + "rgba(" + + raw_rgb.r + "," + + raw_rgb.g + "," + + raw_rgb.b + ","+ + alpha + ")"; + } + break; case 'hsv': break; default: @@ -708,3 +721,7 @@ } return define_Please(); })); + + + + \ No newline at end of file From 50181192959df17ba00e0833923aea4f7676515e Mon Sep 17 00:00:00 2001 From: azurylattice Date: Fri, 4 Mar 2016 22:07:55 -0800 Subject: [PATCH 02/11] add rgba option --- src/Please.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Please.js b/src/Please.js index 4bb2a20..58f22b8 100644 --- a/src/Please.js +++ b/src/Please.js @@ -1,4 +1,5 @@ /*!Please JS v0.4.2, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/ +var alpha = 1; (function( globalName, root, factory ) { if ( typeof define === 'function' && define.amd ) { define( [], factory ); @@ -178,13 +179,12 @@ colors_returned: 1, format: 'hex', seed: null, - + alpha: 1 }; var make_scheme_default = { scheme_type: 'analogous', format: 'hex' - alpha: 1.0 // default to opaque }; var make_contrast_default = { @@ -235,7 +235,7 @@ raw_rgb.b + ")"; } break; - case 'rgb-alpha': + case 'rgba': for ( i = 0; i < array.length; i++ ) { var raw_rgb = Please.HSV_to_RGB( array[i] ); array[i] = @@ -302,6 +302,15 @@ }; } + var alpha=1; + Please.Alpha = function(a){ + if(a>1||a<0){ + alpha=1; + } + alpha=a; + } + + Please.NAME_to_HEX = function( name ){ name = name.toLowerCase(); if( name in color_data ){ @@ -573,8 +582,8 @@ var color = [], //clone base please options color_options = copy_object( make_color_default ), + base_color = null; - if( options !== null ){ //override base Please options for( var key in options ){ @@ -583,13 +592,14 @@ } } } + console.log(color_options.alpha); + Please.Alpha(color_options.alpha); var randomiser = null; if (typeof color_options.seed === 'string') { randomiser = new RC4Random(color_options.seed); } - //first, check for a base color if ( color_options.base_color.length > 0 ) { //then determine if its a hex string or a named color @@ -723,5 +733,5 @@ })); - +console.log(Please.make_color({colors_returned:3, format:'rgba', alpha:0.9})); \ No newline at end of file From 141e5707ac0a4802e7245b9652e302c20d2cee09 Mon Sep 17 00:00:00 2001 From: azurylattice Date: Fri, 4 Mar 2016 22:12:55 -0800 Subject: [PATCH 03/11] remove space>< --- src/Please.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Please.js b/src/Please.js index 58f22b8..c7d93f6 100644 --- a/src/Please.js +++ b/src/Please.js @@ -309,7 +309,6 @@ var alpha = 1; } alpha=a; } - Please.NAME_to_HEX = function( name ){ name = name.toLowerCase(); @@ -592,7 +591,6 @@ var alpha = 1; } } } - console.log(color_options.alpha); Please.Alpha(color_options.alpha); var randomiser = null; @@ -730,8 +728,4 @@ var alpha = 1; return Please; } return define_Please(); -})); - - -console.log(Please.make_color({colors_returned:3, format:'rgba', alpha:0.9})); - \ No newline at end of file +})); \ No newline at end of file From 86b5079074f2e50e5bb92612ae19a28d6961e4b2 Mon Sep 17 00:00:00 2001 From: azurylattice Date: Fri, 4 Mar 2016 23:04:38 -0800 Subject: [PATCH 04/11] core only~~ --- LISCENSE-MIT | 22 ---- Please_docs.txt | 175 --------------------------- README.md | 204 -------------------------------- bower.json | 23 ---- dist/Please.js | 2 - gulpfile.js | 42 ------- package.json | 32 ----- src/{Please.js => Please-al.js} | 6 +- src/test.html | 5 + 9 files changed, 10 insertions(+), 501 deletions(-) delete mode 100644 LISCENSE-MIT delete mode 100755 Please_docs.txt delete mode 100644 README.md delete mode 100644 bower.json delete mode 100644 dist/Please.js delete mode 100644 gulpfile.js delete mode 100644 package.json rename src/{Please.js => Please-al.js} (99%) create mode 100644 src/test.html diff --git a/LISCENSE-MIT b/LISCENSE-MIT deleted file mode 100644 index e6d5cbe..0000000 --- a/LISCENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright © 2014 Jordan Checkman - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Please_docs.txt b/Please_docs.txt deleted file mode 100755 index ec8e34a..0000000 --- a/Please_docs.txt +++ /dev/null @@ -1,175 +0,0 @@ -Please.js -Jordan Checkman -Checkman.io - -Please.js is a polite companion that wants to help you make your projects beautiful. It uses HSV color space to create random pleasing colors as well as color schemes based on a given color. - -It has two core functions and a bunch of little helpers for you to use. - ------CORE----- -Please.make_color(options) - -The make_color function by default will generate and return a random hex string using the golden ratio to ensure that the color will look nice on your screen. - -You can also pass an options object to make_color and have it do a whole bunch of different things. - -make_color options: - -hue: (0-360) -By setting the hue, you determine the color. - -saturation: (0.0-1.0) -By setting the saturation, you determine the distance from gray. - -value: (0.0-1.0) -By setting the value, you determine the balance between black and white. - -base_color: ("the name of an HTML color") -Setting a base_color (e.g. "pink") will create a random color within the HSV range of the chosen color. Please will recognize any of the 146 standard HTML colors, it has a very good memory. - -greyscale | grayscale: (true/false) -Setting either greyscale or grayscale (but we all know which one is correct) to true will cause all of the colors you generate to be within the grey or gray range. This is effectively the same as setting your saturation to 0. - -golden: (true/false) -Setting golden to true randomizes your hue (overrides hue setting) and makes you a spectacular color based on the golden ratio. It's so good, it's the default. Make sure to turn it off if you want to have more control over your generated colors. - -full_random: (true/false) -Setting full_random to true will make Please lose its mind. It will completely randomize the hue, saturation, and value of the colors it makes. - -colors_returned: (1-infinity) -Setting colors_returned to higher than 1 will return an array full of the colors Please has made for you. If you set it to 1, you'll just get the one color! It makes a sort of sense if you think about it. - -format: ("format string") -Setting format string, will change the format of what make_color will return for you. The options are as follows (example is the color black): -"hex" = "#000000" -"rgb" = {r: 0, g: 0, b: 0} -"rgb-string" = "rgb(0,0,0)" -"hsv" = {h: 0, s: 0, v: 0} - -Here are the defaults for each option: -{ - hue: null, - saturation: null, - value: null, - base_color: '', - greyscale: false, - grayscale: false, - golden: true, - full_random: false, - colors_returned: 1, - format: 'hex' -} - -Here is an example of a fully random color call: -Please.make_color({ - golden: false, - full_random:true -}); - -Here is an example that will produce 100 reds as RGB strings: -Please.make_color({ - golden: false, - base_color: 'red', - colors_returned: 100, - format: 'rgb-string' -}); - --------------- - -The second core function allows Please to make a color scheme for you. - -Please.make_scheme(base_color, options) - -The make scheme function will return a series of colors based upon the color and options you feed it. The base_color must be in HSV color space and is an object in the format of -{ - h: ___, - s: ___, - v: ___ -} - -make_scheme options: - -scheme_type -"monochromatic" | "mono" - Makes a 5 color scheme using your provided color, all the colors will be fairly similar to each other. - -"complementary" | "complement" - Makes a two color scheme using your provided color, the 2nd color will be the complement of the 1st, such that mixing them will create a neutral grey. - -"split-complementary" | "split-complement" | "split" - Makes a three color scheme where the 2nd and 3rd colors are at a 30 degree split from the complement of the 1st color. - -"double-complementary" | "double-complement" | "double" - Makes a four color scheme where the 2nd color is the complement of the 1st, and the 3rd and 4th colors are complements of each other at a 30 degree ofset from the first pair - -"analogous" | "ana" - Makes a six color scheme where each additional color is offset from the 1st by 20 degrees. - -"triadic" | "triad" | "tri" - Makes a 3 color scheme where the 2nd and 3rd color are equally spaced from the 1st. - -format: ("format string") -Setting format string, will change the format of what make scheme will return for you. The options are as follows (example is the color white): -"hex" = "#ffffff" -"rgb" = {r: 255, g: 255,b: 255} -"rgb-string" = "rgb(255,255,255)" -"hsv" = {h: 0, s: 0, v: 1} - -Here is an example of a complementary scheme in hex: -Please.make_scheme( -{ - h: 130, - s: .7, - v: .75 -}, -{ - scheme_type: "complement", - format: "hex" -}); - -Here is an example that will produce a triadic scheme in rgb-strings: -Please.make_scheme( -{ - h: 130, - s: .7, - v: .75 -}, -{ - scheme_type: "triadic", - format: "rgb-string" -}); - -Here are the defaults for each option: -{ - scheme_type: 'analogous', - format: 'hex' -} - ------BONUS----- - -Please also has some bonus features, it allows you to convert freely between the color formats of RGB, HSV, and HEX. - -RGB_to_HEX() -HEX_to_RGB() -RGB_to_HSV() -HSV_to_RGB() -HEX_to_HSV() -HSV_to_HEX() - -conversion from HSV or RGB expect an object with the properties -{ - r: 0-255, - g: 0-255, - b: 0-255 -} -and -{ - h: 0-360, - s: 0.0-1.0, - v: 0,0-1.0 -} -respectively, while converstions from HEX expect a string. Return formats are modeled the same way as the arguments. - -In addition Please, can convert from an HTML color name into HEX, RGB, or HSV. - -NAME_to_HEX() -NAME_to_RGB() -NAME_to_HSV() - -These functions take a string and return a HEX string or an RGB/HSV object. - -I hope you enjoy using Please. Have fun, and remember to say the magic word. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 35cb7f8..0000000 --- a/README.md +++ /dev/null @@ -1,204 +0,0 @@ -#PleaseJS - -www.checkman.io/please - -Please.js is a polite companion that wants to help you make your projects beautiful. It uses HSV color space to create random pleasing colors as well as color schemes based on a given color. -It has two core functions and a bunch of little helpers for you to use. - - -```js -Please.make_color(); -//or -Please.make_scheme( -{ - h: 145, - s: .7, - v: .6 -}, -{ - scheme_type: 'triadic', - format: 'rgb-string' -}); -``` - -##Core - -### make_color - -```js -Please.make_color({options}) -``` - -The make_color function by default will generate and return a random hex string using the golden ratio to ensure that the color will look nice on your screen. - -You can also pass an options object to make_color and have it do a whole bunch of different things. - -#### make_color options: - - * **hue**: `(0-360)` By setting the hue, you determine the color. - * **saturation**: `(0.0-1.0)` By setting the saturation, you determine the distance from gray. - * **value**: `(0.0-1.0)` By setting the value, you determine the balance between black and white. - * **base_color**: `('the name of an HTML color')` Setting a base_color (e.g. 'pink') will create a random color within the HSV range of the chosen color. Please will recognize any of the 146 standard HTML colors, it has a very good memory. - * **greyscale** | **grayscale**: `(true/false)` Setting either greyscale or grayscale (but we all know which one is correct) to true will cause all of the colors you generate to be within the grey or gray range. This is effectively the same as setting your saturation to 0. - * **golden**: `(true/false)` Setting golden to true randomizes your hue (overrides hue setting) and makes you a spectacular color based on the golden ratio. It's so good, it's the default. Make sure to turn it off if you want to have more control over your generated colors. - * **full_random**: `(true/false)` Setting full_random to true will make Please lose its mind. It will completely randomize the hue, saturation, and value of the colors it makes. - * **colors_returned**: `(1-infinity)` Setting colors_returned to higher than 1 will return an array full of the colors Please has made for you. If you set it to 1, you'll just get the one color! It makes a sort of sense if you think about it. - * **format**: `('format string')` Setting format string, will change the format of what make_color will return for you. The options are as follows (example is the color black): - * `'hex'` = '#000000' - * `'rgb'` = {r: 0, g: 0,b: 0} - * `'rgb-string'` = 'rgb(0,0,0)' - * `'hsv'` = {h: 0, s: 0, v: 0} - -Here are the defaults for each option: -```js -{ - hue: null, - saturation: null, - value: null, - base_color: '', - greyscale: false, - grayscale: false, - golden: true, - full_random: false, - colors_returned: 1, - format: 'hex', -} -``` - -Here is an example of a fully random color call: -```js -Please.make_color({ - golden: false, - full_random: true -}); -``` - -Here is an example that will produce 100 reds as RGB strings: -```js -Please.make_color({ - golden: false, - base_color: 'red', - colors_returned: 100, - format: 'rgb-string' -}); -``` - --------------- - -### make_scheme - -The second core function allows Please to make a color scheme for you. - -```js -Please.make_scheme(base_color,{options}) -``` - -The make scheme function will return a series of colors based upon the color and options you feed it. The base_color must be in HSV color space and is an object in the format of -```js -{ - h: ___, - s: ___, - v: ___ -} -``` - -#### make_scheme options: - - * **scheme_type** - * `'monochromatic'` | `'mono'` - Makes a 5 color scheme using your provided color, all the colors will be fairly similar to each other. - * `'complementary'` | `'complement'` - Makes a two color scheme using your provided color, the 2nd color will be the complement of the 1st, such that mixing them will create a neutral grey. - * `'split-complementary'` | `'split-complement'` | `'split'` - Makes a three color scheme where the 2nd and 3rd colors are at a 30 degree split from the complement of the 1st color. - * `'double-complementary'` | `'double-complement'` | `'double'` - Makes a four color scheme where the 2nd color is the complement of the 1st, and the 3rd and 4th colors are complements of each other at a 30 degree ofset from the first pair - * `'analogous'` | `'ana'` - Makes a six color scheme where each additional color is offset from the 1st by 20 degrees. - * `'triadic'` | `'triad'` | `'tri'` - Makes a 3 color scheme where the 2nd and 3rd color are equally spaced from the 1st. - * **format**: `('format string')` Setting format string, will change the format of what make scheme will return for you. The options are as follows (example is the color white): - * `'hex'` = '#ffffff' - * `'rgb'` = {r: 255, g: 255,b: 255} - * `'rgb-string'` = 'rgb(255,255,255)' - * `'hsv'` = {h: 0, s: 0, v: 1} - -Here is an example of a complementary scheme in hex: -```js -Please.make_scheme( -{ - h: 130, - s: .7. - v: .75 -}, -{ - scheme_type: 'complement', - format: 'hex' -}); -``` - -Here is an example that will produce a triadic scheme in rgb-strings: -```js -Please.make_scheme( -{ - h: 130, - s: .7. - v: .75 -}, -{ - scheme_type: 'triadic', - format: 'rgb-string' -}); -``` - -Here are the defaults for each option: -```js -{ - scheme_type: 'analogous', - format: 'hex' -} -``` - --------------- - -## Other Methods - -Please also has some bonus features. It allows you to convert freely between the color formats of RGB, HSV, and HEX. - -RGB_to_HEX() -HEX_to_RGB() -RGB_to_HSV() -HSV_to_RGB() -HEX_to_HSV() -HSV_to_HEX() - -conversion from HSV or RGB expect an object with the properties -```js -{ - r: 0-255, - g: 0-255, - b: 0-255 -} -``` -and -```js -{ - h: 0-360, - s: 0.0-1.0, - v: 0,0-1.0 -} -``` - -respectively, while converstions from HEX expect a string. Return formats are modeled the same way as the arguments. - -In addition Please, can convert from an HTML color name into HEX, RGB, or HSV. - -```js -NAME_to_HEX() -NAME_to_RGB() -NAME_to_HSV() -``` - -These functions take a string and return a HEX string or an RGB/HSV object. - -I hope you enjoy using Please. Have fun, and remember to say the magic word. - --------------- - -## License - -MIT diff --git a/bower.json b/bower.json deleted file mode 100644 index 0256a16..0000000 --- a/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "pleasejs", - "version": "0.4.2", - "homepage": "https://github.com/Fooidge/PleaseJS", - "authors": [ - "Fooidge" - ], - "description": "JS library to generate random pleasing colors/color schemes", - "main": "dist/Please.js", - "keywords": [ - "color", - "scheme", - "random" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/dist/Please.js b/dist/Please.js deleted file mode 100644 index 75629ed..0000000 --- a/dist/Please.js +++ /dev/null @@ -1,2 +0,0 @@ -/*!Please JS v0.4.2, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/ -!function(e,r,a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():r[e]=a()}("Please",this,function(){"use strict";function e(){function e(e,r,a){var o=Math.random;return a instanceof l&&(o=a.random),Math.floor(o()*(r-e+1))+e}function r(e,r,a){var o=Math.random;return a instanceof l&&(o=a.random),o()*(r-e)+e}function a(e,r,a){return Math.max(r,Math.min(e,a))}function o(e,r){var a;switch(e){case"hex":for(a=0;a=128?"dark":"light"}function t(e){var r={};for(var a in e)e.hasOwnProperty(a)&&(r[a]=e[a]);return r}function l(e){function r(){o=(o+1)%256,n=(n+a[o])%256;var e=a[o];return a[o]=a[n],a[n]=e,a[(a[o]+a[n])%256]}for(var a=[],o=0,n=0,t=0;256>t;t++)a[t]=t;for(var l=0,F=0;256>l;l++){F=(F+a[l]+e.charCodeAt(l%e.length))%256;var s=a[l];a[l]=a[F],a[F]=s}this.random=function(){for(var e=0,a=0,o=1;8>e;e++)a+=r()*o,o*=256;return a/0x10000000000000000}}var F={},s={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"00FFFF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000000",blanchedalmond:"FFEBCD",blue:"0000FF",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"00FFFF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgrey:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dimgrey:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"FF00FF",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",grey:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3D3D3",lightgrey:"D3D3D3",lightgreen:"90EE90",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"663399",red:"FF0000",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFFFFF",whitesmoke:"F5F5F5",yellow:"FFFF00",yellowgreen:"9ACD32"},i=.618033988749895,u={hue:null,saturation:null,value:null,base_color:"",greyscale:!1,grayscale:!1,golden:!0,full_random:!1,colors_returned:1,format:"hex",seed:null},c={scheme_type:"analogous",format:"hex"},h={golden:!1,format:"hex"};return F.NAME_to_HEX=function(e){return e=e.toLowerCase(),e in s?s[e]:(console.error("Color name not recognized."),void 0)},F.NAME_to_RGB=function(e){return F.HEX_to_RGB(F.NAME_to_HEX(e))},F.NAME_to_HSV=function(e){return F.HEX_to_HSV(F.NAME_to_HEX(e))},F.HEX_to_RGB=function(e){var r=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(r,function(e,r,a,o){return r+r+a+a+o+o});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null},F.RGB_to_HEX=function(e){return"#"+((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)},F.HSV_to_RGB=function(e){var r,a,o,n,t,l,F,s,i=e.h,u=e.s,c=e.v;if(0===u)return{r:c,g:c,b:c};switch(i/=60,n=Math.floor(i),t=i-n,l=c*(1-u),F=c*(1-u*t),s=c*(1-u*(1-t)),n){case 0:r=c,a=s,o=l;break;case 1:r=F,a=c,o=l;break;case 2:r=l,a=c,o=s;break;case 3:r=l,a=F,o=c;break;case 4:r=s,a=l,o=c;break;case 5:r=c,a=l,o=F}return{r:Math.floor(255*r),g:Math.floor(255*a),b:Math.floor(255*o)}},F.RGB_to_HSV=function(e){var r=e.r/255,a=e.g/255,o=e.b/255,n=0,t=0,l=0,F=Math.min(r,Math.min(a,o)),s=Math.max(r,Math.max(a,o));if(F===s)return l=F,{h:0,s:0,v:l};var i=r===F?a-o:o===F?r-a:o-r,u=r===F?3:o===F?1:5;return n=60*(u-i/(s-F)),t=(s-F)/s,l=s,{h:n,s:t,v:l}},F.HSV_to_HEX=function(e){return F.RGB_to_HEX(F.HSV_to_RGB(e))},F.HEX_to_HSV=function(e){return F.RGB_to_HSV(F.HEX_to_RGB(e))},F.make_scheme=function(e,r){function n(e){return{h:e.h,s:e.s,v:e.v}}var l,F,s,i,u,h=t(c);if(null!==r)for(var d in r)r.hasOwnProperty(d)&&(h[d]=r[d]);var g=[e];switch(h.scheme_type.toLowerCase()){case"monochromatic":case"mono":for(u=1;2>=u;u++)l=n(e),s=l.s+.1*u,s=a(s,0,1),i=l.v+.1*u,i=a(i,0,1),l.s=s,l.v=i,g.push(l);for(u=1;2>=u;u++)l=n(e),s=l.s-.1*u,s=a(s,0,1),i=l.v-.1*u,i=a(i,0,1),l.s=s,l.v=i,g.push(l);break;case"complementary":case"complement":case"comp":l=n(e),l.h=(l.h+180)%360,g.push(l);break;case"split-complementary":case"split-complement":case"split":l=n(e),l.h=(l.h+165)%360,g.push(l),l=n(e),l.h=Math.abs((l.h-165)%360),g.push(l);break;case"double-complementary":case"double-complement":case"double":l=n(e),l.h=(l.h+180)%360,g.push(l),l.h=(l.h+30)%360,F=n(l),g.push(l),l.h=(l.h+180)%360,g.push(F);break;case"analogous":case"ana":for(u=1;5>=u;u++)l=n(e),l.h=(l.h+20*u)%360,g.push(l);break;case"triadic":case"triad":case"tri":for(u=1;3>u;u++)l=n(e),l.h=(l.h+120*u)%360,g.push(l);break;default:console.error("Color scheme not recognized.")}return o(h.format.toLowerCase(),g),g},F.make_color=function(n){var s=[],c=t(u),h=null;if(null!==n)for(var d in n)n.hasOwnProperty(d)&&(c[d]=n[d]);var g=null;"string"==typeof c.seed&&(g=new l(c.seed)),c.base_color.length>0&&(h=c.base_color.match(/^#?([0-9a-f]{3})([0-9a-f]{3})?$/i)?F.HEX_to_HSV(c.base_color):F.NAME_to_HSV(c.base_color));for(var m=0;m + + + + \ No newline at end of file From 06e10ae78f8d607eddb3680d2c3fe4462b2369c3 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:07:55 -0800 Subject: [PATCH 05/11] Create README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0628957 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# PleaseJS +JavaScript Library for creating random pleasing colors and color schemes +Forked from: https://github.com/Fooidge/PleaseJS + +Added new format: "rgba"; alpha default to 1: opaque + +Example Usage: Please.make_color({colors_returned:3, format:'rgba', alpha:0.2}); +==> +["rgba(114,127,191,0.9)", "rgba(191,116,114,0.9)", "rgba(191,181,114,0.9)"] From 2081caf937cd5d214e48aa86e56359e498cd38e2 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:08:19 -0800 Subject: [PATCH 06/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0628957..12c8144 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# PleaseJS +# PleaseJS-al version JavaScript Library for creating random pleasing colors and color schemes Forked from: https://github.com/Fooidge/PleaseJS From 7f9aace3484899161e515c2ee5dcd67f4de844b4 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:08:52 -0800 Subject: [PATCH 07/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12c8144..633d4eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PleaseJS-al version JavaScript Library for creating random pleasing colors and color schemes -Forked from: https://github.com/Fooidge/PleaseJS + Forked from: https://github.com/Fooidge/PleaseJS Added new format: "rgba"; alpha default to 1: opaque From ba1a2eafc0e21b90cc628b527eb34269f2c7d0a6 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:09:12 -0800 Subject: [PATCH 08/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 633d4eb..3c32f12 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PleaseJS-al version JavaScript Library for creating random pleasing colors and color schemes - Forked from: https://github.com/Fooidge/PleaseJS +{Origin} Forked from: https://github.com/Fooidge/PleaseJS Added new format: "rgba"; alpha default to 1: opaque From a82f43bf94775a0c29a1c33c966853aae32a0225 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:09:31 -0800 Subject: [PATCH 09/11] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3c32f12..f426053 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # PleaseJS-al version JavaScript Library for creating random pleasing colors and color schemes + + {Origin} Forked from: https://github.com/Fooidge/PleaseJS Added new format: "rgba"; alpha default to 1: opaque From d81b68cfd3e09cbabfb1e5f42b976d10b3873c47 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:09:44 -0800 Subject: [PATCH 10/11] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f426053..3ad78bb 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,7 @@ JavaScript Library for creating random pleasing colors and color schemes Added new format: "rgba"; alpha default to 1: opaque Example Usage: Please.make_color({colors_returned:3, format:'rgba', alpha:0.2}); + + ==> ["rgba(114,127,191,0.9)", "rgba(191,116,114,0.9)", "rgba(191,181,114,0.9)"] From 5e3a2eab60a18d127b60229dd01c8e749f360152 Mon Sep 17 00:00:00 2001 From: azzurolilc Date: Fri, 4 Mar 2016 23:10:06 -0800 Subject: [PATCH 11/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ad78bb..8b9c3be 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,4 @@ Example Usage: Please.make_color({colors_returned:3, format:'rgba', alpha:0.2}); ==> -["rgba(114,127,191,0.9)", "rgba(191,116,114,0.9)", "rgba(191,181,114,0.9)"] +["rgba(114,127,191,0.2)", "rgba(191,116,114,0.2)", "rgba(191,181,114,0.2)"]