Character.ai Custom CSS

Apply custom CSS styles to character.ai

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Character.ai Custom CSS
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Apply custom CSS styles to character.ai
// @author       Vishanka
// @match        https://character.ai/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Function to create or update a style element
    function updateCSSVariable(variableName, value) {
        document.documentElement.style.setProperty(variableName, value);
    }

    // Update the specific CSS variables
    updateCSSVariable('--G850', '#2B2C2D');
    updateCSSVariable('--G900', '#242525');
    updateCSSVariable('--G950', '#1E1F1F');

    // Custom CSS for specific classes
    const customClassStyles = `
        .mt-1.bg-surface-elevation-2 { background-color: #2B2C2D !important; }
        .mt-1.bg-surface-elevation-3 { background-color: #2B2C2D !important; }
    `;

    // Inject the custom styles for classes into the page
    GM_addStyle(customClassStyles);

})();