Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
HappyCoding.io uses a random background image whenever you load a page. Those images are generated using code, and I'd love other people to contribute their own images (and the source code that generated them)!
If you want to create and contribute your own images and code, just follow these steps:
Step 1: Play with some code.
On HappyCoding.io, scroll to the bottom and find the link to the code for that page's background image, or just go here to see a list of all of the code.
Download the file and open it in your Processing editor (it will ask if you want to move it into a directory, this is normal). You'll see that I've overridden Processing's drawing functions so that they wrap around the edges of the screen, so any generated images can be tiled as background images. I've also used the
save() function to save the sketch as an image.
Use that as a starting point to write your own code.
Step 2: Generate some image files.
HappyCoding.io contains a feature that allows users to switch between light and dark themes, so try to generate two images: one for the light theme, and one for the dark theme.
Make the images unobtrusive, so they don't distract too much from the main content. For light images, I've used
fill(random(222, 256)) to generate nice-looking light shades, and for dark images, I've used
fill(random(0, 32)) to generate nice-looking dark shades.
save("YouImageFileNameHere") function makes it easy to output whatever is currently showing in your sketch as an image file.
Step 3: Submit your stuff!
If you're new to GitHub or contributing to open source, feel free to post your images to forum.HappyCoding.io instead. I can add them to the site for you, or help walk you through the process of contributing them.
If you are familiar with GitHub, then you need to do three things: