Make active highlight color configurable

This commit is contained in:
Max Goodhart
2020-09-09 23:03:55 -07:00
parent e2c5414608
commit 84e97b9310
3 changed files with 17 additions and 6 deletions

View File

@@ -11,6 +11,9 @@
# Set the background color (useful for chroma-keying) # Set the background color (useful for chroma-keying)
#background-color = "#0f0" #background-color = "#0f0"
# Set the active (highlight) color
#active-color = "#fff"
[grid] [grid]
#count = 3 #count = 3

View File

@@ -5,6 +5,7 @@ import { State } from 'xstate'
import styled from 'styled-components' import styled from 'styled-components'
import { useHotkeys } from 'react-hotkeys-hook' import { useHotkeys } from 'react-hotkeys-hook'
import { TailSpin } from 'svg-loaders-react' import { TailSpin } from 'svg-loaders-react'
import Color from 'color'
import '../index.css' import '../index.css'
@@ -16,7 +17,7 @@ import YouTubeIcon from '../static/youtube.svg'
import SoundIcon from '../static/volume-up-solid.svg' import SoundIcon from '../static/volume-up-solid.svg'
function Overlay({ config, views, streams }) { function Overlay({ config, views, streams }) {
const { width, height } = config const { width, height, activeColor } = config
const activeViews = views const activeViews = views
.map(({ state, context }) => State.from(state, context)) .map(({ state, context }) => State.from(state, context))
.filter((s) => s.matches('displaying') && !s.matches('displaying.error')) .filter((s) => s.matches('displaying') && !s.matches('displaying.error'))
@@ -39,11 +40,12 @@ function Overlay({ config, views, streams }) {
pos={pos} pos={pos}
windowWidth={width} windowWidth={width}
windowHeight={height} windowHeight={height}
activeColor={activeColor}
isListening={isListening} isListening={isListening}
> >
<BlurCover isBlurred={isBlurred} /> <BlurCover isBlurred={isBlurred} />
{data && ( {data && (
<StreamTitle isListening={isListening}> <StreamTitle activeColor={activeColor} isListening={isListening}>
<StreamIcon url={content.url} /> <StreamIcon url={content.url} />
<span> <span>
{data.hasOwnProperty('label') ? ( {data.hasOwnProperty('label') ? (
@@ -149,8 +151,8 @@ const SpaceBorder = styled.div.attrs((props) => ({
pos.y === 0 ? 0 : borderWidth}px; pos.y === 0 ? 0 : borderWidth}px;
border-bottom-width: ${({ pos, borderWidth, windowHeight }) => border-bottom-width: ${({ pos, borderWidth, windowHeight }) =>
pos.y + pos.height === windowHeight ? 0 : borderWidth}px; pos.y + pos.height === windowHeight ? 0 : borderWidth}px;
box-shadow: ${({ isListening }) => box-shadow: ${({ isListening, activeColor }) =>
isListening ? '0 0 10px red inset' : 'none'}; isListening ? `0 0 10px ${activeColor} inset` : 'none'};
box-sizing: border-box; box-sizing: border-box;
pointer-events: none; pointer-events: none;
user-select: none; user-select: none;
@@ -167,8 +169,8 @@ const StreamTitle = styled.div`
color: white; color: white;
text-shadow: 0 0 4px black; text-shadow: 0 0 4px black;
letter-spacing: -0.025em; letter-spacing: -0.025em;
background: ${({ isListening }) => background: ${({ isListening, activeColor }) =>
isListening ? 'rgba(255, 0, 0, 0.5)' : 'rgba(0, 0, 0, 0.5)'}; Color(isListening ? activeColor : 'black').alpha(0.5)};
border-radius: 4px; border-radius: 4px;
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
overflow: hidden; overflow: hidden;

View File

@@ -39,6 +39,7 @@ function parseArgs() {
'window.y', 'window.y',
'window.frameless', 'window.frameless',
'window.background-color', 'window.background-color',
'window.active-color',
], ],
'Window settings', 'Window settings',
) )
@@ -64,6 +65,10 @@ function parseArgs() {
describe: 'Background color of wall (useful for chroma-keying)', describe: 'Background color of wall (useful for chroma-keying)',
default: '#000', default: '#000',
}) })
.option('window.active-color', {
describe: 'Active (highlight) color of wall',
default: '#fff',
})
.group(['data.interval', 'data.json-url', 'data.toml-file'], 'Datasources') .group(['data.interval', 'data.json-url', 'data.toml-file'], 'Datasources')
.option('data.interval', { .option('data.interval', {
describe: 'Interval (in seconds) for refreshing polled data sources', describe: 'Interval (in seconds) for refreshing polled data sources',
@@ -233,6 +238,7 @@ async function main() {
width: argv.window.width, width: argv.window.width,
height: argv.window.height, height: argv.window.height,
gridCount: argv.grid.count, gridCount: argv.grid.count,
activeColor: argv.window['active-color'],
}, },
auth: auth.getState(), auth: auth.getState(),
streams: [], streams: [],