Recently, Stack Exchange decided to switch to system fonts. For those of you who prefered the old appearance, or would like a different font to appear in code blocks or across the site as a whole, Custom Fonts is a user script I wrote this morning to allow just that.
Features
Custom Fonts allows rules to be set for different sites, which can specify a sans serif, serif, and monospace font. A default can also be specified, allowing you to choose between sans serif and serif for any site.
Custom Fonts initially doesn't change anything (unless you download one with a preset), but on lines 26 and 27 are rules that revert all of Stack Exchange to its original fonts (once un-commented). Custom rules can be written, and there is a short reference in the comments under the Rules
object.
Download
Custom Fonts is a user script, meaning that it requires Greasemonkey (Firefox or browsers that support Firefox extensions) or Tampermonkey (Chrome or browsers that support Chrome extensions) to be installed.
@run-at document-start
) so there shouldn't be a visible delay very often. A lot more people have userscript managers installed than userstyle ones, so I figured this would be useful to share, at least as a temporary solution.@match https://stackexchange.com
. This line wasn't there in 1.2.1, which does work fine.@exclude
s for chat and the APIdocument-start
the<head>
and<body>
elements will commonly not yet exist. The element which is guaranteed to exist and to which you can.appendChild
is thedocument.documentElement
. However, given that usingdocument.documentElement.appendChild
at that time will result in your<style>
being before the<head>
in the document, you will need to make sure that the CSS rules have a higher specificity than the ones you're wanting to replace, because they will be before, not after, any rules in CSS provided by the page. (continued)