colourify

This script makes all the web pages colorful.

  1. // ==UserScript==
  2. // @name colourify
  3. // @namespace colour
  4. // @description This script makes all the web pages colorful.
  5. // @include *
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9. var anchors = document.body.getElementsByTagName('p');
  10. var a = [
  11. 'blue',
  12. '#000000',
  13. '#660033',
  14. '#006666'
  15. ];
  16. var b = [
  17. '#f2f2f2',
  18. '#ffffcc',
  19. '#ccff99',
  20. '#b3ffff',
  21. '#66ff66',
  22. ' #ffe6b3'
  23. ];
  24. for (var i = 0; i < anchors.length; i++)
  25. {
  26. //anchors[i++].innerHTML = anchors[Math.floor(Math.random()*anchors.length)].innerHTML ;
  27. // anchors[i].innerHTML = anchors[i++].innerHTML;
  28. //anchors[i].style.color = a[Math.floor(Math.random()*a.length)] ;
  29. anchors[i].style.background = b[Math.floor(Math.random() * b.length)];
  30. // anchors[i].style.border = "thin";
  31. //anchors[i].style.borderBottomColor = "red";
  32. /*
  33.  
  34.  
  35. */
  36. }
  37. var anchors = document.body.getElementsByTagName('div');
  38. var a = [
  39. 'blue',
  40. '#000000',
  41. '#660033',
  42. '#006666'
  43. ];
  44. var b = [
  45. '#f2f2f2',
  46. '#ffffcc',
  47. '#ccff99',
  48. '#b3ffff',
  49. '#66ff66',
  50. ' #ffe6b3'
  51. ];
  52. for (var i = 0; i < anchors.length; i++)
  53. {
  54. //anchors[i].innerHTML = anchors[i++].innerHTML;
  55. // anchors[i++].innerHTML = anchors[i].innerHTML ;
  56. anchors[i].style.color = a[Math.floor(Math.random() * a.length)];
  57. // anchors[i].style.background = b[Math.floor(Math.random()*b.length)] ;
  58. }
  59.  
  60.  
  61.  
  62. function addGlobalStyle(css) {
  63. var head, style;
  64. head = document.getElementsByTagName('head')[0];
  65. if (!head) { return; }
  66. style = document.createElement('style');
  67. style.type = 'text/css';
  68. style.innerHTML = css;
  69. head.appendChild(style);
  70. }
  71.  
  72. addGlobalStyle('p { box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); padding: 4px 16px; border-radius: 20px; }');
  73.  
  74. //addGlobalStyle('a { box-shadow: 0 4px 6px 0px rgba(0,0,0,0.2);border-radius: 5px; }');
  75.  
  76. // font-size: large ! important;