Comments (4)
So in JavaScript, and many other languages when you call a function they return a value to you.
Please.make_color() currently returns a color to you as a hex value string.
so
var aNiceColor = Please.make_color();
would store the result of make_color() is the variable aNiceColor.
But you don't always need the variable!
Here's a more complicated example:
Please.make_scheme(Please.make_color({format: 'hsv'}),{scheme_type: 'analogous'});
In here we don't store to a variable. Instead, the return value of one function is immediately consumed by the next in order to fuel it's code.
I hope this makes sense.
from pleasejs.
Thanks for the explanation!! I get the variables bit, although feeling a bit stupid that didn't crossed my mind.
If it is not a problem to clarify the second example in more detail, where is the result stored and how should I fetch it?
Thanks
from pleasejs.
I call the function, store it as a variable, and then write the result as the contents of a div. I assume this is what you want?
http://jsfiddle.net/9588evd6/
Each time you press "Run" you'll get a new color. You can change the parameter and return amounts to change the number and type of colors you get.
It can be modified to also set the div to be a square and set the background color to the color as well if you'd like it to be a bit more visual.
from pleasejs.
@kyokou Thanks, that is exactly what I needed. I think I will have something to play with tonight by setting up a test page with colored divs and changing their bg color!
Thanks
from pleasejs.
Related Issues (20)
- Returns an array containing sometimes the same colors HOT 1
- make_scheme() 'mono', actually renders 4 colors instead of 5 HOT 4
- Bump npm to newest version HOT 1
- Generate constant color for an object based on a key. HOT 4
- Question: Lite version?
- make_color() returns "#00000.randomhex" when base_color: black HOT 1
- Better Documentation
- Change the dist file name with `.min.` suffix
- Documentation about colors_returned=1 says you only get one, I expected a string HOT 3
- greyscale: true generates ["#000000.36cd673"]
- How do i get color by opacity HOT 1
- Please publish to NPM HOT 1
- Add Plz mode
- Generate Material Design shades from single color
- human distinguishable
- Colours returned are waaay too long for HEX! HOT 1
- Invalid conversion rgb-hsv
- Domain Expired HOT 1
- Any way to fork and create website? HOT 8
- Archive?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pleasejs.