This is my userscript to change the color of visited links. It is assumed to be able to work with any website.
// ==UserScript==
// @name Change the color of visited links
// @description -
// @match *://*/*
// ==/UserScript==
function style(css) {
let head, style;
head = document.getElementsByTagName('head')[0];
if (!head) return;
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css.replace(/;/g, '!important;');
head.appendChild(style);
}
function links(anylink, link, visited, hover, active) {
style(`
${anylink} { outline: solid 1px; }
${link} { color: blue; }
${visited} { color: fuchsia; }
${hover} { color: red; }
${active} { color: yellow; }
`);
}
links('a:any-link , a:any-link *',
'a:link , a:link *',
'a:visited , a:visited *',
'a:hover , a:hover *',
'a:active , a:active *'
);
The problem is that on some websites some links belong to shadow DOM elements, and by this reason they are not affected by the script. How this can be fixed?
temporary screenshot, see comments

You can access the shadow DOM with
document.querySelector(selector).shadowRootFrom there all you need to find the first
headusingquerySelectorAllor default to the element itself, and inject the CSS there.