// SPDX-FileCopyrightText: 2025  Noor Ahmad <noora@ruc.dk>
// SPDX-License-Identifier: GPL-3.0-or-later

let button;
let bgColor;  // a variable that keeps track of the background color
let isBlack = true; // Starts with black

function setup() {
  createCanvas(800, 500);
  bgColor = color(15, 15, 60);
  button = createButton("Color");
  button.mouseClicked(changeBackground);
  button.size(50, 50);
  button.position(350, 210);
} 

function draw() {
  background(bgColor);
}

function changeBackground() {
  if (isBlack) {
    bgColor = color(255, 223, 0);  // Yellow
  } else {
    bgColor = color(15, 15, 60);  // Black
  }
  isBlack = !isBlack;  // Changing between true and false
}