Custom fonts by vednoc

Imported 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 atApril 26, 2021 15:56

Updated atMay 06, 2021 21:59

Applies toglobal

Statistics

Learn how we calculate statistics in the FAQ.

Total views197

Total installs507

Weekly installs40

Weekly updates50

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-172021-07-262021-08-042021-08-132021-08-222021-08-312021-09-092021-09-182021-09-272021-10-062021-10-15Date0.005.3010.5015.8021.0026.3031.5036.8042.00Daily countDaily installsDaily updatesDaily views
2021-07-072021-07-172021-07-262021-08-042021-08-132021-08-222021-08-312021-09-092021-09-182021-09-272021-10-062021-10-15Date0.0064.00128.00192.00255.00319.00383.00447.00510.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

No reviews yet.