Diep.io Grayscale Theme

read the title

  1. // ==UserScript==
  2. // @name Diep.io Grayscale Theme
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description read the title
  6. // @author bismuth
  7. // @match *diep.io
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license none
  11. // ==/UserScript==
  12. ['stroke','fill'].forEach(method => {
  13. CanvasRenderingContext2D.prototype[method] = new Proxy(CanvasRenderingContext2D.prototype[method], {
  14. apply: (target,_this,args) => {
  15. //console.log(_this.fillStyle);
  16. const fill = [parseInt(_this[`${method}Style`].slice(1,3), 16), parseInt(_this[`${method}Style`].slice(3,5), 16), parseInt(_this[`${method}Style`].slice(5,7), 16)];
  17. const grayscaleValue = ((((fill[0] << 4) - fill[0] + fill[1] + (fill[2] << 4)) >> 5) & 255).toString(16);
  18. _this[`${method}Style`] = `#${grayscaleValue}${grayscaleValue}${grayscaleValue}`;
  19. return Reflect.apply(target,_this,args);
  20. }
  21. });
  22. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址