知识库
特殊 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 全部
P |
---|
PleaseJS Color Library色轮模式参看🎞️Adobe Color #PleaseJS 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. Please.make_color(); //or Please.make_scheme( { h: 145, s: .7, v: .6 }, { scheme_type: 'triadic', format: 'rgb-string' }); ##Core make_colorPlease.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:
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' }); make_schemeThe 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:
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' } Other MethodsPlease 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. | |