// ==UserScript== // @name Character.AI Text Color // @namespace Character.AI Text Color by Vishanka // @match https://plus.character.ai/* // @grant none // @license MIT // @version 1.4 // @author Vishanka via chatGPT // @description Changes the color of all text except the text within "Quotation Marks" // @icon https://i.imgur.com/ynjBqKW.png // @downloadURL none // ==/UserScript== (function() { var css = "p, .swiper-no-swiping div { color: #958C7F !important; font-family: 'Noto Sans', sans-serif !important; }"; var head = document.getElementsByTagName("head")[0]; var style = document.createElement("style"); style.setAttribute("type", 'text/css'); style.innerHTML = css; head.appendChild(style); })(); function changeColors() { const pTags = document.getElementsByTagName('p'); for (let i = 0; i < pTags.length; i++) { const pTag = pTags[i]; if ( pTag.dataset.colorChanged === 'true' || pTag.querySelector('code') || pTag.querySelector('img') ) { continue; } let text = pTag.innerHTML; const aTags = pTag.getElementsByTagName('a'); // Get all tags within the

tag // Remove the tags temporarily for (let j = 0; j < aTags.length; j++) { const aTag = aTags[j]; text = text.replace(aTag.outerHTML, 'REPLACE_ME_' + j); // Use a placeholder to be able to restore the links later } //Changes Text within Quotation Marks to white if (text.match(/(["“”«»].*?["“”«»])/)) { text = text.replace(/(["“”«»].*?["“”«»])/g, '$1'); } //Changes Text within Quotation Marks and a comma at the end to orange if (text.match(/(["“”«»][^"]*?,["“”«»])/)) { text = text.replace(/(["“”«»][^"]*?,["“”«»])/g, '$1'); } //Changes Italic Text to gold if (text.match(/(.*?)<\/em>/)) { text = text.replace(/(.*?)<\/em>/g, '$1'); } if (text.match(/(seems)/)) { text = text.replace(/(seems)/g, '$1'); } if (text.match(/(seem)/)) { text = text.replace(/(seem)/g, '$1'); } // Restore the tags for (let j = 0; j < aTags.length; j++) { const aTag = aTags[j]; text = text.replace('REPLACE_ME_' + j, aTag.outerHTML); } pTag.innerHTML = text; pTag.dataset.colorChanged = 'true'; } console.log('Changed colors'); } // Observe changes in the document and call changeColors() whenever mutations occur const observer = new MutationObserver(changeColors); observer.observe(document, { subtree: true, childList: true }); // Initially apply the color changes changeColors();