You haven't mentioned wich imageboard you're talking about.
I think it's 4chan.
Higlighting visited threads in catalog there ― it's completely possible to achieve with just CSS.
The page at StackOverflow explains
https://stackoverflow.com/questions/56418220/css-selectors-avisited-childs
https://css-tricks.com/almanac/selectors/v/visited/
> You can only use :visited to change those properties if the link already has them in the “unvisited” or :link state. You can’t use it to add properties that aren’t already present on the link.
So your userstyle piece would be
#threads > .thread > a > img {
border: 3px solid;
border-color: #1d1f21;
}
#threads > .thread > a:visited > img {
border-color: red;
}
If you use different style, change the border-color to the style's border-color (so the border would not highlight ordinary iterms).