From 51b72325f2da25bdf0d068700a6fdb5096818eed Mon Sep 17 00:00:00 2001 From: Harrison Harnisch Date: Thu, 21 Jul 2016 14:07:19 -0500 Subject: [PATCH] configurable cursor opacity (#76) --- app/lib/components/term.js | 5 +++-- app/package.json | 1 + config-default.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/lib/components/term.js b/app/lib/components/term.js index aba01e68..2d733cf9 100644 --- a/app/lib/components/term.js +++ b/app/lib/components/term.js @@ -1,5 +1,6 @@ /* global Blob,URL,requestAnimationFrame */ import React from 'react'; +import Color from 'color'; import hterm from '../hterm'; import Component from '../component'; @@ -26,7 +27,7 @@ export default class Term extends Component { this.term.prefs_.set('font-family', props.fontFamily); this.term.prefs_.set('font-size', props.fontSize); this.term.prefs_.set('font-smoothing', props.fontSmoothing); - this.term.prefs_.set('cursor-color', props.cursorColor); + this.term.prefs_.set('cursor-color', Color(props.cursorColor).rgbString()); this.term.prefs_.set('enable-clipboard-notice', false); this.term.prefs_.set('foreground-color', props.foregroundColor); this.term.prefs_.set('background-color', props.backgroundColor); @@ -181,7 +182,7 @@ export default class Term extends Component { } if (this.props.cursorColor !== nextProps.cursorColor) { - this.term.prefs_.set('cursor-color', nextProps.cursorColor); + this.term.prefs_.set('cursor-color', Color(nextProps.cursorColor).rgbString()); } if (this.props.colors !== nextProps.colors) { diff --git a/app/package.json b/app/package.json index 97c24dfb..91ea65ab 100644 --- a/app/package.json +++ b/app/package.json @@ -6,6 +6,7 @@ "repository": "zeit/hyperterm", "dependencies": { "aphrodite-simple": "0.4.1", + "color": "^0.11.3", "hterm-umdjs": "1.1.3", "json-loader": "0.5.4", "mousetrap": "1.6.0", diff --git a/config-default.js b/config-default.js index c13f9168..72bec07d 100644 --- a/config-default.js +++ b/config-default.js @@ -6,8 +6,8 @@ module.exports = { // font family with optional fallbacks fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace', - // terminal cursor background color (hex) - cursorColor: '#F81CE5', + // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) + cursorColor: 'rgba(248,28,229,0.75)', // color of the text foregroundColor: '#fff',