Jupyter Lab默認字體較小,觀察起來不太方便,由于Jupyter Lab版本變化比較頻繁,改變字體的方法也不太穩定,適用版本:JupyterLab 3.0.12,
方法一:通過選單Settings->Jupyterlab Theme,生成themes.jupyterlab-settings檔案
Settings選單Jupyterlab Theme子選單可改變字體大小,每次修改字體幅度為1px,修改字體后,將生成themes.jupyterlab-settings檔案中,配置內容即保存在該檔案,
Increase/Decrease Code Font Size:增加/減小代碼、輸出單元格字體大小,Increase/Decrease Content Font Size:增加/減小內容單元格字體大小,Increase/Decrease UI Font Size:增加/減小UI字體大小,

組態檔路徑樣例:C:\Users\Administrator\.jupyter\lab\user-settings\@jupyterlab\apputils-extension\themes.jupyterlab-settings
檔案內容如下:"content-font-size1": "24px"即內容字體大小,"code-font-size": "24px"即代碼和輸出單元格字體大小,"ui-font-size1": "12px"即UI字體大小,
{
// Theme
// @jupyterlab/apputils-extension:themes
// Theme manager settings.
// *************************************
// Theme CSS Overrides
// Override theme CSS variables by setting key-value pairs here
"overrides": {
"content-font-size1": "24px",
"code-font-size": "24px",
"ui-font-size1": "12px"
},
// Scrollbar Theming
// Enable/disable styling of the application scrollbars
"theme-scrollbars": true
}
修改選單后檔案變化情況,
{
// Theme
// @jupyterlab/apputils-extension:themes
// Theme manager settings.
// *************************************
// Theme CSS Overrides
// Override theme CSS variables by setting key-value pairs here
"overrides": {
"content-font-size1": "25px",
"code-font-size": "24px",
"ui-font-size1": "15px"
},
// Selected Theme
// Application-level visual styling theme
"theme": "JupyterLab Light",
// Scrollbar Theming
// Enable/disable styling of the application scrollbars
"theme-scrollbars": false
}
方法二:通過選單Settings->Advanced Settings Editor,生成tracker.jupyterlab-settings檔案
注意:這種方法不能修改單元格輸出的字體大小,而且會覆寫第一種方法的字體設定,
- 點擊
Settings選單中的Advanced Settings Editor,

- 在高級編輯器中選擇
Notebook項,默認用戶配置為空,
3. 在用戶配置中,輸入以下內容并保存,
{
"codeCellConfig": {
"fontSize": 20,
},
"markdownCellConfig": {
"fontSize": 20,
},
"rawCellConfig": {
"fontSize": 20,
},
}
4. 配置保存后,將生成tracker.jupyterlab-settings檔案,檔案內容如下:
{
"codeCellConfig": {
"fontSize": 26,
},
"markdownCellConfig": {
"fontSize": 26,
},
"rawCellConfig": {
"fontSize": 26,
},
}
總結
建議使用第一種方法修改字體大小,這種方法可修改單元格輸出結果的字體大小,
默認情況下,用戶組態檔是不存在的,只有使用選單或者高級設定編輯器修改字體配置后,才會產生組態檔,用戶組態檔均保存在C:\Users\Administrator\.jupyter\lab\user-settings\@jupyterlab目錄中,
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/272267.html
標籤:其他
上一篇:YUV的存盤格式
