Skip to content

Commit 6fa5ad5

Browse files
committedNov 17, 2022
feat(theme): add fontFamily option. #409
1 parent f8cb858 commit 6fa5ad5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎themes/theme/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ export interface Settings {
251251
gutterActiveForeground?: string;
252252
/** Gutter right border color. */
253253
gutterBorder?: string;
254+
/** set editor font */
255+
fontFamily?: string;
254256
}
255257
declare const createTheme: ({ dark, settings, styles }: CreateThemeOptions) => Extension;
256258
export default createTheme;

‎themes/theme/src/index.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export interface Settings {
3939
gutterActiveForeground?: string;
4040
/** Gutter right border color. */
4141
gutterBorder?: string;
42+
/** set editor font */
43+
fontFamily?: string;
4244
}
4345

4446
export const createTheme = ({ theme, settings, styles }: CreateThemeOptions): Extension => {
@@ -50,6 +52,9 @@ export const createTheme = ({ theme, settings, styles }: CreateThemeOptions): Ex
5052
'.cm-gutters': {},
5153
};
5254

55+
if (settings.fontFamily) {
56+
themeOptions['&.cm-editor .cm-scroller'].fontFamily = settings.fontFamily;
57+
}
5358
if (settings.gutterBackground) {
5459
themeOptions['.cm-gutters'].backgroundColor = settings.gutterBackground;
5560
}

0 commit comments

Comments
 (0)
Please sign in to comment.