Custom fonts by vednoc

Imported and mirrored from https://raw.githubusercontent.com/vednoc/custom-fonts/main/fonts.user.styl

Custom fonts screenshot
Homepage Install Get Stylus Write a review

Details

Authorvednoc

LicenseMIT

Created

Updated

Categoryglobal

Statistics

Learn how we calculate statistics in the FAQ.

Total views1021

Total installs4160

Weekly installs88

Description

Apply custom base font globally.

Notes

Inspired by openstyles/stylus/#1236. If you find bugs and/or have suggestions, feel free to open an issue on GitHub.

History

Daily snapshots of style statistics.

2021-07-072021-07-312021-08-232021-09-152021-10-082021-10-312021-11-232021-12-162022-01-082022-01-312022-02-232022-03-18Date0.007.3014.5021.8029.0036.3043.5050.8058.00Daily countDaily installsDaily updatesDaily views
2021-07-072021-08-022021-08-272021-09-222021-10-172021-11-112021-12-072022-01-012022-01-272022-02-212022-03-18Date0.00190.00380.00570.00750.00940.001130.001320.001500.00Total countTotal installsTotal views

Source code

/* ==UserStyle==
@name         Custom fonts
@namespace    github.com/vednoc/custom-fonts
@description  Apply custom base font globally.
@author       vednoc <vednoc@pm.me> (https://github.com/vednoc)
@homepageURL  https://github.com/vednoc/custom-fonts
@supportURL   https://github.com/vednoc/custom-fonts/issues
@updateURL    https://userstyles.world/api/style/85.user.css
@preprocessor stylus
@version      0.3.0
@license      MIT

@var text base 'Base font' '"your favorite base font"'
@var text mono 'Mono font' '"your favorite mono font"'
@var checkbox inputs 'Use monospace font in input areas' 0
==/UserStyle== */

@-moz-document regexp("https?://.*") {
    i = !important

    // Exclude default code areas.
    n ?= ':not(code):not(pre):not(pre > span):not(code > span)'

    // Exclude icon fonts.
    n += ':not(.i):not(.icon)'
    n += ':not(.fa):not(.fab):not(.fad):not(.fal):not(.far):not(.fas)'
    n += ':not([class*="octicon-"])' // github
    n += ':not(.glyphicon)' // searx
    n += ':not([aria-hidden=true])' // google meet
    n += ':not([class*=material-icons])' // material icons
    n += ':not([class*=icofont])' // icofont icons
    n += ':not([class*=selector__glyph][data-bind])' // fontello icons

    // Exclude icons on DuckDuckGo.
    n += ':not(input[id^="search"][type=submit][value=S])' // search bar
    n += ':not([class*="js-side-menu-"])' // navbar menu
    n += ':not(.ddgsi):not(.btn--icon)' // misc icons

    // Exclude code areas on GitHub.
    n += ':not([class^="blob-"]):not([class^="blob-"] > span)'

    // Exclude code areas on GitLab.
    n += ':not(.diff-line-num):not(pre > code > span span)'
    n += ':not(.diff-viewer *)' // commit diff

    // Editors.
    n += ':not(.ace_editor):not(.ace_editor *)' // #2
    n += ':not(.CodeMirror):not(.CodeMirror *)'
    n += ':not(.monaco-editor *)'
    n += ':not(#squire *)' // protonmail

    // Use monospace input font on Discord.
    if inputs {
        n += ':not([data-slate-editor=true] *)'
    }

    // Exclude Gmail composer and font menu.
    n += ':not(div[jsaction][jslog] *)'
    n += ':not([id][style*="font-family"]):not([id][style*="font-family"] *)'

    // Exclude utility classes for fonts.
    n += ':not(.monospace):not(.text-mono)'

    // Feat -> Change base fonts in input areas.
    if inputs {
        n += ':not(input):not(textarea)'

        // Gmail elements.
        $d ?= ':not([g_editable])'
        $i ?= ':not([name="subjectbox"])'

        // Workaround for specificity issues.
        :not(#z) {
            [contenteditable="true"]{ $d } *,
            input{ $i },
            textarea {
                font-family: mono, monospace i
            }
        }
    }

    // Generate.
    { n } {
        font-family: base, serif i
    }
}

Reviews

selyts reviewed and gave 5/5 ⭐
Fyi, setting fonts you have installed yourself does NOT work if you have enabled `privacy.resistFingerprinting` in Firefox. This blocks CSS access to many fonts.