Add fontWeight and fontWeightBold settings (#2669)

Fixes #2574
This commit is contained in:
CHaBou 2018-02-14 14:09:02 +01:00 committed by Albin Ekblom
parent 6d61ac400c
commit b73a328b6b
7 changed files with 37 additions and 0 deletions

View file

@ -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)',

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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;
}

View file

@ -208,6 +208,15 @@
<td>The font family to use for the UI with optional fallbacks</td>
</tr>
<tr>
<td>"fontWeight"</td>
<td>"normal"</td>
<td>The default font weight: "normal" or "bold"</td>
</tr>
<tr>
<td>"fontWeightBold"</td>
<td>"bold"</td>
<td>The font weight for bold characters: "normal" or "bold"</td>
</tr>
<tr>
<td>"cursorColor"</td>
<td>"#F81CE5"</td>