Anthropic Console Theme Changer

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

目前為 2025-02-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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 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 });
})();