(() => {
const styleId = 'force-black-text-snippet';
const existing = document.getElementById(styleId);
if (existing) {
existing.remove();
} else {
const style = document.createElement('style');
style.id = styleId;
style.textContent = `
*, *::before, *::after {
color: #000000 !important;
}
`;
document.head.appendChild(style);
}
})();
or
for light black font to black
(() => {
// Adjust threshold (0-255): 100 catches dark grays & charcoal; lower = stricter
const DARK_THRESHOLD = 100;
document.querySelectorAll('*').forEach(el => {
// Only target elements that directly contain visible text
const hasDirectText = Array.from(el.childNodes).some(
node => node.nodeType === Node.TEXT_NODE && node.textContent.trim().length > 0
);
if (!hasDirectText) return;
const color = getComputedStyle(el).color;
const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
if (match) {
const r = parseInt(match[1], 10);
const g = parseInt(match[2], 10);
const b = parseInt(match[3], 10);
const a = match[4] !== undefined ? parseFloat(match[4]) : 1;
// Skip fully transparent text
if (a === 0) return;
// Check if all RGB channels are dark (black-like / dark gray)
if (r <= DARK_THRESHOLD && g <= DARK_THRESHOLD && b <= DARK_THRESHOLD) {
el.style.setProperty('color', '#000000', 'important');
}
}
});
})();