⟵ Back to the Storefront!

API

Hello! If you are a developer or webmaster you can access the TextureTown API to include textures in your project!

All textures are listed in the manifest in JSON format: textures.neocities.org/manifest.json - The JSON file is split between "info" and "catalogue"


To construct a texture link see the example script below!

You can also access thumbnails in the same fashion - select from the thumbnail folder - prefix the filename with "thumb_" and replace the filetype with .jpg (all thumbnails are jpg format!)

To find a specific file or category by name, I suggest using a map (e.g. in Javascript catalogue.map(x => x[name]);)

Finally you can access a pretty formatted section name using catalogue[INDEX OF THE CATEGORY YOU WANT].niceName - e.g. "Fire & Light"


Here is a simple random fire texture script to use on your site!

//Download the Manifest File
fetch("https://textures.neocities.org/manifest.json")
    .then((res) => res.json())
    .then((json) => {
        //Success! Your code goes here!
        let manifest = json;

        //Get the index of the fire category
        let fireIndex = manifest.catalogue
            .map(function (e) {
                return e.name;
            })
            .indexOf("fire-and-light");

        //Pick a random image from that category
        let fireCatagoryFileCount = manifest.catalogue[fireIndex].files.length;
        let randomImageName = manifest.catalogue[fireIndex].files[
            Math.floor(Math.random() * fireCatagoryFileCount) + 1];

        //Create a full texture url
        let textureURL = manifest.info.base_url + "/" 
        + manifest.info.textures_folder + "/" + manifest.catalogue[fireIndex].name 
        + "/" + randomImageName;

        alert(textureURL);
    });
                

Please note! Textures and names do change - if you need a file permanently make sure to download it.