mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 05:38:41 -09:00
Fix webgl config (#3407)
* Fix location of webGLRenderer flag in default-config.js * Fix incorrect check of webGLRenderer flag * Explain that disabling WebGL enables transparent backgrounds Co-Authored-By: juancampa <juancampa@gmail.com> * Only use WebGL if background is opaque The hardcoding to white was also removed in favor of a temporary hack in xterm.js that uses either white-over-black or black-overwhite to maximize contrast with the background color
This commit is contained in:
parent
ea3e109fbb
commit
519ca3e651
3 changed files with 9 additions and 10 deletions
|
|
@ -133,6 +133,10 @@ module.exports = {
|
||||||
// URL to custom bell
|
// URL to custom bell
|
||||||
// bellSoundURL: 'http://example.com/bell.mp3',
|
// bellSoundURL: 'http://example.com/bell.mp3',
|
||||||
|
|
||||||
|
// Whether to use the WebGL renderer. Set it to false to use canvas-based
|
||||||
|
// rendering (slower, but supports transparent backgrounds)
|
||||||
|
webGLRenderer: true,
|
||||||
|
|
||||||
// for advanced config flags please refer to https://hyper.is/#cfg
|
// for advanced config flags please refer to https://hyper.is/#cfg
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -149,8 +153,6 @@ module.exports = {
|
||||||
// to load it and avoid it being `npm install`ed
|
// to load it and avoid it being `npm install`ed
|
||||||
localPlugins: [],
|
localPlugins: [],
|
||||||
|
|
||||||
webGLRenderer: true,
|
|
||||||
|
|
||||||
keymaps: {
|
keymaps: {
|
||||||
// Example
|
// Example
|
||||||
// 'window:devtools': 'cmd+alt+o',
|
// 'window:devtools': 'cmd+alt+o',
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ const getTermOptions = props => {
|
||||||
// Set a background color only if it is opaque
|
// Set a background color only if it is opaque
|
||||||
const needTransparency = Color(props.backgroundColor).alpha() < 1;
|
const needTransparency = Color(props.backgroundColor).alpha() < 1;
|
||||||
const backgroundColor = needTransparency ? 'transparent' : props.backgroundColor;
|
const backgroundColor = needTransparency ? 'transparent' : props.backgroundColor;
|
||||||
|
const useWebGL = props.webGLRenderer && !needTransparency;
|
||||||
return {
|
return {
|
||||||
macOptionIsMeta: props.modifierKeys.altIsMeta,
|
macOptionIsMeta: props.modifierKeys.altIsMeta,
|
||||||
scrollback: props.scrollback,
|
scrollback: props.scrollback,
|
||||||
|
|
@ -40,18 +41,14 @@ const getTermOptions = props => {
|
||||||
// HACK: Terminal.setOption breaks if we don't apply these in this order
|
// HACK: Terminal.setOption breaks if we don't apply these in this order
|
||||||
// TODO: The above notice can be removed once this is addressed:
|
// TODO: The above notice can be removed once this is addressed:
|
||||||
// https://github.com/xtermjs/xterm.js/pull/1790#issuecomment-450000121
|
// https://github.com/xtermjs/xterm.js/pull/1790#issuecomment-450000121
|
||||||
rendererType: props.webGLRenderer ? 'webgl' : 'canvas',
|
rendererType: useWebGL ? 'webgl' : 'canvas',
|
||||||
experimentalCharAtlas: props.webGLRenderer ? 'webgl' : 'dynamic',
|
experimentalCharAtlas: useWebGL ? 'webgl' : 'dynamic',
|
||||||
theme: {
|
theme: {
|
||||||
foreground: props.foregroundColor,
|
foreground: props.foregroundColor,
|
||||||
background: backgroundColor,
|
background: backgroundColor,
|
||||||
cursor: props.cursorColor,
|
cursor: props.cursorColor,
|
||||||
cursorAccent: props.cursorAccentColor,
|
cursorAccent: props.cursorAccentColor,
|
||||||
// TODO: This hard codes the selection color to opaque white because the
|
selection: props.selectionColor,
|
||||||
// webgl renderer doesn't support anything else at the moment. Remove this
|
|
||||||
// once WebGL gets support for selection color. Discussed here:
|
|
||||||
// https://github.com/xtermjs/xterm.js/pull/1790
|
|
||||||
selection: props.webGLRenderer ? '#fff' : props.selectionColor,
|
|
||||||
black: props.colors.black,
|
black: props.colors.black,
|
||||||
red: props.colors.red,
|
red: props.colors.red,
|
||||||
green: props.colors.green,
|
green: props.colors.green,
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ const reducer = (state = initial, action) => {
|
||||||
ret.quickEdit = config.quickEdit;
|
ret.quickEdit = config.quickEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config.webGLRenderer !== undefined) {
|
if (config.webGLRenderer !== undefined) {
|
||||||
ret.webGLRenderer = config.webGLRenderer;
|
ret.webGLRenderer = config.webGLRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue