input contrast

Force inputs colors on pages

  1. // ==UserScript==
  2. // @name input contrast
  3. // @namespace config@gedweb.name
  4. // @description Force inputs colors on pages
  5. // @include *
  6. // @version 1.0.4
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. list = document.querySelectorAll('input, select, option, textarea');
  11.  
  12. for (i = 0; i < list.length; i++) {
  13.  
  14. if (list[i].hasAttribute("type") && list[i].getAttribute("type") === "image") {
  15. continue;
  16. }
  17.  
  18. if (document.defaultView.getDefaultComputedStyle(list[i]).backgroundColor === document.defaultView.getComputedStyle(list[i]).backgroundColor) {
  19. list[i].style.backgroundImage = "repeating-linear-gradient(-45deg, #f8f8f8, #f8f8f8 2px, #fefefe 1px, #fefefe 12px)";
  20. list[i].style.backgroundColor = "#fefefe";
  21. list[i].style.color = "#202020";
  22. }
  23. if (document.defaultView.getComputedStyle(list[i]).borderStyle === "") {
  24. list[i].style.borderStyle = "solid";
  25. list[i].style.borderWidth = "1px";
  26. }
  27. }