Greasy Fork

Greasy Fork is available in English.

Anthropic Console Theme Changer

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Anthropic Console Theme Changer
// @version      0.1.1
// @description  将 Anthropic Console 改回浅色模式 switch the Anthropic Console to light mode
// @author       chesha1
// @license      GPL-3.0-only
// @match        https://console.anthropic.com/*
// @grant        none
// @homepageURL  https://github.com/chesha1/anthropic-console-theme-changer
// @supportURL   https://github.com/chesha1/anthropic-console-theme-changer/issues
// @namespace http://greasyfork.icu/users/1422393
// ==/UserScript==

(function () {
  'use strict';

  // 立即执行一次修改
  function changeTheme() {
    const htmlElement = document.documentElement;
    if (htmlElement.getAttribute('data-theme') === 'console') {
      htmlElement.setAttribute('data-theme', 'claude');
      console.log('主题已从 console 更改为 claude');
    }
  }

  // 页面加载完成后执行
  changeTheme();

  // 使用 MutationObserver 监听可能的动态变化
  const observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      if (mutation.attributeName === 'data-theme'
        && document.documentElement.getAttribute('data-theme') === 'console') {
        changeTheme();
      }
    });
  });

  // 配置 observer 监听 HTML 元素的属性变化
  observer.observe(document.documentElement, { attributes: true });
})();