From b73a328b6b3c5b717da952976e889c948183bb0c Mon Sep 17 00:00:00 2001 From: CHaBou Date: Wed, 14 Feb 2018 14:09:02 +0100 Subject: [PATCH] Add `fontWeight` and `fontWeightBold` settings (#2669) Fixes #2574 --- app/config/config-default.js | 6 ++++++ lib/components/term-group.js | 2 ++ lib/components/term.js | 2 ++ lib/components/terms.js | 2 ++ lib/containers/terms.js | 2 ++ lib/reducers/ui.js | 14 ++++++++++++++ website/index.html | 9 +++++++++ 7 files changed, 37 insertions(+) diff --git a/app/config/config-default.js b/app/config/config-default.js index 6f335336..742a361b 100644 --- a/app/config/config-default.js +++ b/app/config/config-default.js @@ -14,6 +14,12 @@ module.exports = { // font family with optional fallbacks fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', + // default font weight: 'normal' or 'bold' + fontWeight: 'normal', + + // font weight for bold characters: 'normal' or 'bold' + fontWeightBold: 'bold', + // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) cursorColor: 'rgba(248,28,229,0.8)', diff --git a/lib/components/term-group.js b/lib/components/term-group.js index d24f4e76..57fca106 100644 --- a/lib/components/term-group.js +++ b/lib/components/term-group.js @@ -70,6 +70,8 @@ class TermGroup_ extends PureComponent { fontFamily: this.props.fontFamily, uiFontFamily: this.props.uiFontFamily, fontSmoothing: this.props.fontSmoothing, + fontWeight: this.props.fontWeight, + fontWeightBold: this.props.fontWeightBold, modifierKeys: this.props.modifierKeys, padding: this.props.padding, url: session.url, diff --git a/lib/components/term.js b/lib/components/term.js index d0e2949a..d103fd55 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -26,6 +26,8 @@ const getTermOptions = props => { cursorBlink: props.cursorBlink, fontFamily: props.fontFamily, fontSize: props.fontSize, + fontWeight: props.fontWeight, + fontWeightBold: props.fontWeightBold, allowTransparency: true, theme: { foreground: props.foregroundColor, diff --git a/lib/components/terms.js b/lib/components/terms.js index 0f3aa643..faeb1d95 100644 --- a/lib/components/terms.js +++ b/lib/components/terms.js @@ -100,6 +100,8 @@ export default class Terms extends Component { fontSize: this.props.fontSize, fontFamily: this.props.fontFamily, uiFontFamily: this.props.uiFontFamily, + fontWeight: this.props.fontWeight, + fontWeightBold: this.props.fontWeightBold, padding: this.props.padding, bell: this.props.bell, bellSoundURL: this.props.bellSoundURL, diff --git a/lib/containers/terms.js b/lib/containers/terms.js index fa393a8e..d80b0082 100644 --- a/lib/containers/terms.js +++ b/lib/containers/terms.js @@ -24,6 +24,8 @@ const TermsContainer = connect( write: state.sessions.write, fontSize: state.ui.fontSizeOverride ? state.ui.fontSizeOverride : state.ui.fontSize, fontFamily: state.ui.fontFamily, + fontWeight: state.ui.fontWeight, + fontWeightBold: state.ui.fontWeightBold, uiFontFamily: state.ui.uiFontFamily, fontSmoothing: state.ui.fontSmoothingOverride, padding: state.ui.padding, diff --git a/lib/reducers/ui.js b/lib/reducers/ui.js index be8e561b..658bdf32 100644 --- a/lib/reducers/ui.js +++ b/lib/reducers/ui.js @@ -46,6 +46,8 @@ const initial = Immutable({ '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif', fontSizeOverride: null, fontSmoothingOverride: 'antialiased', + fontWeight: 'normal', + fontWeightBold: 'bold', css: '', termCSS: '', openAt: {}, @@ -129,6 +131,18 @@ const reducer = (state = initial, action) => { ret.uiFontFamily = config.uiFontFamily; } + if (config.fontWeight) { + ret.fontWeight = config.fontWeight; + } + + if (config.fontWeightBold) { + ret.fontWeightBold = config.fontWeightBold; + } + + if (config.uiFontFamily) { + ret.uiFontFamily = config.uiFontFamily; + } + if (config.cursorColor) { ret.cursorColor = config.cursorColor; } diff --git a/website/index.html b/website/index.html index 941fb94d..aba551a3 100644 --- a/website/index.html +++ b/website/index.html @@ -208,6 +208,15 @@ The font family to use for the UI with optional fallbacks + "fontWeight" + "normal" + The default font weight: "normal" or "bold" + + + "fontWeightBold" + "bold" + The font weight for bold characters: "normal" or "bold" + "cursorColor" "#F81CE5"