2011-09-10 123 views
11

我不滿意github上的默認代碼字體是宋體。我想將它更改爲摩納哥,這是我首選的等寬字體。是否有可能更改我的github代碼字體?如果是,如何?更改默認的GitHub代碼字體

+0

什麼是應該的當口,作爲未精製的人,我的情況發生,嘗試查看GitHub上的項目,而不該字體可用(你知道,就像一個非蘋果設備上的)? – delnan

+0

我想看到我的browswer在摩納哥的GitHub代碼。這些設置不應該影響任何其他用戶。他們仍然可以在Courier New中看到它(或者他們配置的任何字體(假設這種配置是可能的))。 – missingfaktor

回答

3

有沒有Github上設置要做到這一點,你必須考慮寫自己的自定義樣式表。這將是瀏覽器的具體情況,你必須手動在所有計算機上同步它,所以它不是很理想。

0

我有Firefox的這個同樣的問題,所以這裏是Greasemonkey的的userscript我使用。只需將其粘貼到腳本編輯器窗口即可。

// ==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 + '; } ' + 
    '');