Created
March 6, 2018 03:08
-
-
Save louisgv/78e89ef0d43c6292d645062374bb6fcf to your computer and use it in GitHub Desktop.
Static Word Cloud Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rawListWords = `Simple | |
Artistic | |
Clean | |
Flat | |
Solid | |
Aesthetic | |
Functional | |
Elegant | |
Professional | |
Helvetica | |
Communication | |
Panel Editing | |
Tool | |
Notification | |
Reminder | |
Social Network | |
Collaboration | |
Messaging | |
Feed | |
Profiles | |
Professional | |
Intuitive | |
Delightful | |
Focused | |
Joyful | |
Approachable | |
Efficient | |
Reliable | |
Easy | |
Friendly | |
Artist | |
Editor | |
Translator | |
Inker | |
Writer | |
Painter | |
Publisher | |
Reader | |
Reviewer | |
Collaborator | |
Networking | |
Feedback | |
Improve | |
Read | |
Rate | |
Share | |
Submit | |
Publish | |
Socialize | |
Discuss` | |
const words = rawListWords.split('\n'); | |
const wordChunk = chunk(words, 10) | |
const COLOR = ['#1abc9c','#f1c40f','#e74c3c','#9b59b6','#2980b9'] | |
const wordMap = wordChunk.map((chunk, i)=>{ | |
const c = COLOR[i]; | |
return chunk.map((w, i)=>{ | |
return `${10-i} ${w} ${c}` | |
}) | |
}) | |
const d = wordMap.map((w)=>w.join("\n")).join("\n"); | |
function chunk (arr, len) { | |
var chunks = [], | |
i = 0, | |
n = arr.length; | |
while (i < n) { | |
chunks.push(arr.slice(i, i += len)); | |
} | |
return chunks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment