Anthropic Console Theme Changer

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

Verze ze dne 25. 02. 2025. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Anthropic Console Theme Changer
// @version      0.1.0
// @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 https://greasyfork.org/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 });
})();