我对github的默认代码字体Courier New感到不满意.我想将它更改为Monaco,这是我首选的等宽字体.是否可以更改我的github代码字体?如果有,怎么样?
我在 Firefox 上也遇到同样的问题,所以这是我正在使用的 Greasemonkey 的用户脚本。只需将其粘贴到脚本编辑器窗口中即可。
// ==UserScript==
// @name Github font changer
// @namespace local.greasemonkey.githubfontchanger
// @include https://github.com/*
// @version 1
// @grant none
// ==/UserScript==
var fontdef ="Monaco, Monospace ! important"; // Set your font here.
// Function helper to inject css
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
// Apply the font-family definition to code styles.
addGlobalStyle(
'.blob-code { font-family: ' + fontdef + '; } ' +
'.blob-num { font-family: ' + fontdef + '; } ' +
'');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7890 次 |
最近记录: |