document.addEventListener('DOMContentLoaded', () => {

  // Get the element and the background color of the element
  const element = document.querySelector('#element');
  const backgroundColor = ColorTool.getBackgroundColor(element);

  // Set opacity to the background color
  const setOpacity = () => element.style.backgroundColor = ColorTool.setOpacity(backgroundColor, 0.5);

  // Remove opacity from the elements background
  const removeOpacity = () => element.style.backgroundColor = ColorTool.removeOpacity(backgroundColor);

  // Set opacity
  setOpacity();

  // Setting and removing opacity depends on leaving or entering the element with the cursor
  element.addEventListener('mouseleave', setOpacity);
  element.addEventListener('mouseenter', removeOpacity);
});