Anthropic Console Theme Changer

将 Anthropic Console 改回浅色模式 switch the Anthropic Console to light mode

当前为 2025-02-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Anthropic Console Theme Changer
  3. // @version 0.1.1
  4. // @description 将 Anthropic Console 改回浅色模式 switch the Anthropic Console to light mode
  5. // @author chesha1
  6. // @license GPL-3.0-only
  7. // @match https://console.anthropic.com/*
  8. // @grant none
  9. // @homepageURL https://github.com/chesha1/anthropic-console-theme-changer
  10. // @supportURL https://github.com/chesha1/anthropic-console-theme-changer/issues
  11. // @namespace https://greasyfork.org/users/1422393
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict';
  16.  
  17. // 立即执行一次修改
  18. function changeTheme() {
  19. const htmlElement = document.documentElement;
  20. if (htmlElement.getAttribute('data-theme') === 'console') {
  21. htmlElement.setAttribute('data-theme', 'claude');
  22. console.log('主题已从 console 更改为 claude');
  23. }
  24. }
  25.  
  26. // 页面加载完成后执行
  27. changeTheme();
  28.  
  29. // 使用 MutationObserver 监听可能的动态变化
  30. const observer = new MutationObserver(function (mutations) {
  31. mutations.forEach(function (mutation) {
  32. if (mutation.attributeName === 'data-theme'
  33. && document.documentElement.getAttribute('data-theme') === 'console') {
  34. changeTheme();
  35. }
  36. });
  37. });
  38.  
  39. // 配置 observer 监听 HTML 元素的属性变化
  40. observer.observe(document.documentElement, { attributes: true });
  41. })();