• Stars
    star
    244
  • Rank 165,885 (Top 4 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Every request returns a different hex code—all 16,777,216 of them.

Hexbot

👋 Meet Hexbot

A different color with every ping.

Every request returns a different hex code. From #000000 to #FFFFFF—and all 16,777,216 colors between—you can do anything you want with the data.

Show the color? Sure.

Show the 80s movie poster with that hex as the dominant color? Better.

🖍 What can you do?

First, you can just request a color with a simple API request:

GET /hexbot

{
  "colors": [
    {"value": "#52a351"}
  ]
}

And then display it:

Job well done. We all have to start somewhere!

Now let's make it more interesting...

GET /hexbot?count=1000&width=500&height=500&seed=FF7F50,FFD700,FF8C00

Now we've added 1000 colors, each with coordinates, and seeded the colors with a range of hex codes. Then we've built up the frames over 100 iterations—much more interesting!

✨ A few ideas

Show the color: Display the color in a square. Hey, that's an accomplishment! It means you've successfully made an API request, handled the data, and did something with it. Not bad! For bonus points, add a way to refresh the API and change the color.

Randomize the colors: Request 1,000 colors and display them at random on screen, then every 5 seconds request another 1,000 colors and animate them to their next color.

Compare colors: A color is actually a very interesting data structure. It has a Red, Green, and Blue value, as well as luminosity and contrast. Given a hex code, can you determine whether a color is light or dark? Or what might pair well with it?

Pointillism: Make an homage to George Seurat, credited with creating Pointillism. Take a picture from the Unsplash API, break it up into smaller pieces, and rebuild it with random colors from the Hexbot. (Pass width and height to the API to get random coordinates with your data)

Search for the color: Use the color to load images from a search engine with color indexes (like DesignInspiration and Dribbble) and do something with the result.

Make a mood ring: Colors are often associated with different traits. Build a color sentiment engine, then evaluate how each color returned by the Hexbot should make you feel.

Name the colors: Paint color names are ridiculous (anything with "Greige" will do nicely), and a robot can come up with even better. You can use a neural net fed with thousands of paint names or make a Markov chain of pleasant, paint-y sounding names.

Why only colors? Who says a hex code has to be a color? Break it up into rgb and you have a 3D coordinate. Use those three points to play a tone, or provide the randomized physics in a game. Convert the value from hex to decimal, and now you have a number between 0 and 16,777,216 to play with.

Have an idea of your own? Create an issue and we'll add it to the list.

🤖 API basics

There's a single endpoint: api.noopschallenge.com/hexbot

The endpoint accepts four parameters, all optional:

  • count (optional, numeric): Between 1 and 1,000. Number of colors to return.
  • width (optional, numeric): Between 10 and 100,000. Maximum width of returned points.
  • height (optional, numeric): Between 10 and 100,000. Maximum height of returned points.
  • seed (optional, string): Comma separated list of hex codes, up to 10. Note that hex codes should not have the #. Returned colors will be a mix of a random combination of two of the seeds. If you submit an invalid hex code, you'll receive an error instead of more beautiful colors.

The endpoint returns a JSON object with an array named colors of n length.

Each item in the colors array is an object with the property value and, optionally, a coordinates object that has x and y properties.

Example return for five colors:

GET /hexbot?count=5

{
  "colors": [
    {"value": "#EF7FED"},
    {"value": "#5F47C2"},
    {"value": "#D5FF9F"},
    {"value": "#62B217"},
    {"value": "#DD36D9"}
  ]
}

Example return for five colors with coordinates:

GET /hexbot?count=5&width=1000&height=1000

{
  "colors":[
    {
      "value":"#2E84C5",
      "coordinates":{"x":755,"y":331}
    },
    {
      "value":"#116BAA",
      "coordinates":{"x":52,"y":998}
    },
    {
      "value":"#C742B2",
      "coordinates":{"x":617,"y":478}
    },
    {
      "value":"#4C2BB9",
      "coordinates":{"x":13,"y":183}
    },
    {
      "value":"#0C98FB",
      "coordinates":{"x":604,"y":507}
    }
  ]
}

Example of seeding colors with a comma delimited string of hex codes:

GET /hexbot?count=5&seed=FF7F50,FFD700,FF8C00

{
  "colors": [
    { "value": "#FF983A" },
    { "value": "#FF7F50" },
    { "value": "#FF7F50" },
    { "value": "#FFAB28" },
    { "value": "#FFBA1A" }
  ]
}

Complete API documentation.

Note to developers

The Hexbot is one of our simpler APIs, and you can easily generate random colors without accessing our API.

Here's the code we use to generate random hex codes (in JavaScript):

function randomHex() {
  const hexMax = 256 * 256 * 256;
  return '#' + Math.floor(Math.random() * hexMax).toString(16).toUpperCase().padStart(6, '0');
}

Implement that function in your code to generate millions of colors.

For manipulating colors, we're using Color, which allows you to change R, G, and B values and mix colors together. Give it a try! 🌈

Bonus: have you written your own implementation of a hex code generator? If you can do it in less than 256 characters, submit it in our Golfbot challenge.

More about Hexbot here: https://noopschallenge.com/challenges/hexbot

More Repositories

1

starters

Guides and libraries to help you get started.
JavaScript
89
star
2

drumbot

Drumbot loves drum machines so much that she made an API dedicated to them. Nothing would make her happier than for you to bring this API to life.
Elixir
89
star
3

fizzbot

Fizzbot has questions for you... so many questions. A FizzBuzz API for you to play with.
Python
45
star
4

mazebot

Mazebot has mazes... a lot of mazes. Can you help it solve them?
JavaScript
36
star
5

wordbot

There are 171,476 words in the English language, and Wordbot knows them backward and forward. Request a hundred verbs, a thousand nouns, or even a hundred dinosaur names, and Wordbot will deliver them in a tidy array.
Ruby
36
star
6

directbot

Up, down, left, right–patterns emerge if you follow the sequence.
JavaScript
21
star
7

golfbot

"Brevity is the soul of great code"—Shakespeare (pretty sure). Code Golf challenges, starting at 256 characters.
HTML
19
star
8

vexbot

Vextbot sends you nothing but vectors—two coordinates and a speed.
JavaScript
19
star
9

melodybot

Melodybot brings a little swing to Drumbot's steady beat. Drumbot emits different beats, and Melodybot provides the melody to go on top of it.
JavaScript
11
star
10

pathbot

A maze without a map. Explore this API step by step.
Jupyter Notebook
9
star
11

cambot

Cameras, microphones, and more—your device is alive with sensors. We've provided some starters to access the sensors on your camera; use the other Noop APIs to enliven the data with random colors, polygons, or sounds!
JavaScript
9
star
12

polybot

With every request, our Polybot will send you up to a thousand polygons from 3 sides (triangle) to 72 sides (a heptacontakaidigon!)
JavaScript
7
star
13

automatabot

Conway's Game of Life, via API. These little cells have a mind of their own. The Automatabot gives you a set of cells and their rules, and challenges you to predict their state after n iterations. IF you succeed, we'll give you a larger and more difficult set of cells.
Go
7
star
14

chartbot

Noops, Inc. is a booming business that generates a ton of not-very-useful statistics. Help us visualize and analyze our nonsense datasets with this API.
JavaScript
5
star
15

riddlebot

Request a set of strings from the API, decode them, and post them back to the API to see if they're correct. If you're right, we'll give you a harder set to solve.
Ruby
5
star
16

interviewbot

Like a whiteboard challenge, except more useless.
Python
2
star
17

mashbot

Mashbot is a very powerful little Noop that fuses the Noops together into a new mega-API. Request colors, polygons, vectors, and directions with a single call.
JavaScript
1
star
18

ideabot

Ideabot wants to hear from YOU! Create an issue with an idea for a Noops challenge—an API, theme, or puzzle.
1
star
19

sortbot

The Sortbot wants everything to be in order. This API sends you lists to sort—numerical, alphabetical, chronological, and all sorts of organized fun.
Ruby
1
star