User:Edit7hesadparts/linkColorRandomizer.js
// randomizes the color of links, adding flare and disambiguating adjacent linked words
// anonymous function to run script once page is fully loaded
$( document ).ready( function () {
// colors pulled from https://www.colorhexa.com/3366cc maybe should add more
// const colors = ["#3366cc", "#33b3cc", "#4c33cc"];
const colors = ["#366ACC", "#3A8ACC", "#6C80FF", "#4C79CC", "#4F8CCC"];
var links = $('#mw-content-text a');
for (var i = 0; i < links.length; i++) {
var link = $(links[i]);
var color = colors[i % (colors.length + 1)];
link.css('color', color);
//links[i].style.color-scheme.color-progressive = #FFFFFF;
}
} );
/*
questions:
how should colors be decided? stick with similar hues of blue, add an element of randomness, have a whole rainbow of colors?
does the color change correctly when the link is hovered, depressed, in history, or for a page that doesn't exist?
does my script react nicely to toggling lightmode/darkmode in the sidebar?
used in some capacity:
https://www.geeksforgeeks.org/how-to-include-css-inside-a-javascript-file/
https://stackoverflow.com/questions/15843581/how-to-correctly-iterate-through-getelementsbyclassname
https://en.wikipedia.org/wiki/User:Jeeputer/highlightPiped.js
- /