Diep.io Borderless

Diep.io theme without borders!

  1. // ==UserScript==
  2. // @name Diep.io Borderless
  3. // @namespace https://diep.io
  4. // @version 1.0
  5. // @description Diep.io theme without borders!
  6. // @author Binary
  7. // @match https://diep.io/*
  8. // @run-at document-end
  9. // ==/UserScript==
  10.  
  11. // [level up bar, score bar, health bar, *score bar for the 4 team colors*]
  12. const whitelistedStrokes = ['rgb(255,222,67)', 'rgb(67,255,145)', 'rgb(133,227,125)', 'rgb(0,178,225)', 'rgb(241,78,84)', 'rgb(0,225,110)', 'rgb(191,127,245)'];
  13. // [blue stroke, red stroke, green stroke, purple stroke], primarily used to take care of circle tank borders. this patch disappears if the tank is hit though (since they temporarily turn red)
  14. const blacklistedFills = ['rgb(0,133,168)', 'rgb(180,58,63)', 'rgb(0,168,82)', 'rgb(143,95,183)'];
  15.  
  16. const strokeDesc = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'strokeStyle');
  17. const fillDesc = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillStyle');
  18.  
  19. strokeDesc.set = new Proxy(strokeDesc.set, {
  20. apply(t, thisArg, args) {
  21. if (!whitelistedStrokes.includes(args[0])) args[0] = 'rgba(0,0,0,0)';
  22. return Reflect.apply(t, thisArg, args);
  23. }
  24. });
  25. fillDesc.set = new Proxy(fillDesc.set, {
  26. apply(t, thisArg, args) {
  27. if (blacklistedFills.includes(args[0])) args[0] = 'rgba(0,0,0,0)';
  28. return Reflect.apply(t, thisArg, args);
  29. }
  30. });
  31. Object.defineProperty(CanvasRenderingContext2D.prototype, 'strokeStyle', strokeDesc);
  32. Object.defineProperty(CanvasRenderingContext2D.prototype, 'fillStyle', fillDesc);