vtally
Version:
An affordable and reliable Tally Light that works via WiFi based on NodeMCU / ESP8266. Supports multiple video mixers.
61 lines (60 loc) • 1.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.YellowPinkColorScheme = exports.DefaultColorScheme = exports.Black = exports.Color = void 0;
class Color {
constructor(r, g, b) {
this.r = r;
this.g = g;
this.b = b;
}
calculateChannel(value, brightness) {
return Math.ceil(value * brightness / 100);
}
// brightness: 0-100
withBrightness(brightness) {
return new Color(this.calculateChannel(this.r, brightness), this.calculateChannel(this.g, brightness), this.calculateChannel(this.b, brightness));
}
toCss() {
return `rgb(${this.r},${this.g},${this.b})`;
}
}
exports.Color = Color;
exports.Black = new Color(0, 0, 0);
exports.DefaultColorScheme = {
id: "default",
name: "Default",
description: "The traditional color scheme for Tally Lights.",
program: new Color(255, 0, 0),
preview: new Color(0, 255, 0),
highlight: new Color(255, 255, 255),
unknown: new Color(0, 0, 255),
idle: new Color(0, 1, 0),
};
exports.YellowPinkColorScheme = {
id: "yellow-pink",
name: "Yellow-Pink",
description: "Intended to give better contrast for the red-green color blind (Protanopia, Deuteranopia).",
program: new Color(255, 255, 0),
preview: new Color(255, 0, 255),
highlight: new Color(255, 255, 255),
unknown: new Color(0, 0, 255),
idle: new Color(0, 1, 0),
};
const ColorSchemes = {
getAll() {
return [exports.DefaultColorScheme, exports.YellowPinkColorScheme];
},
getById(id) {
if (id === "default") {
return exports.DefaultColorScheme;
}
else if (id === "yellow-pink") {
return exports.YellowPinkColorScheme;
}
else {
// if typescript complaints, we missed an option
((_) => { })(id);
}
}
};
exports.default = ColorSchemes;