/** @param {NS} ns */ export async function main(ns) { // Evaluate the document to access the DOM const doc = eval("document"); // Check if the background has already been added to avoid duplicates if (doc.getElementById("terminal-background")) { ns.tprint("Background already set."); return; } // Create a new
element to hold the background image let backgroundDiv = doc.createElement("div"); backgroundDiv.id = "terminal-background"; // Set an ID for later reference // Add CSS styling for the background backgroundDiv.style = ` position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; /* Send it to the back */ background-image: url('https://r4.wallpaperflare.com/wallpaper/510/751/778/akira-kaneda-motorcycle-anime-wallpaper-c90008ed51badd0b96b7680fa02106ad.jpg'); /* Replace with your image URL */ background-size: cover; /* Ensure the image covers the whole screen */ background-repeat: no-repeat; background-position: center; opacity: 0.5; /* Adjust opacity for readability */ `; // Append the background
to the body of the document doc.body.appendChild(backgroundDiv); // Inform the user that the background has been set ns.tprint("Custom background image set successfully!"); }