tweaks to neopixel rendering
This commit is contained in:
parent
910772d54e
commit
8b40850a94
@ -117,8 +117,9 @@ namespace pxsim.visuals {
|
|||||||
public setRgb(rgb: [number, number, number]) {
|
public setRgb(rgb: [number, number, number]) {
|
||||||
let hsl = rgbToHsl(rgb);
|
let hsl = rgbToHsl(rgb);
|
||||||
let [h, s, l] = hsl;
|
let [h, s, l] = hsl;
|
||||||
//We ignore luminosity since it doesn't map well to real-life brightness
|
// at least 70% luminosity
|
||||||
let fill = `hsl(${h}, ${s}%, 70%)`;
|
l = Math.max(l, 60);
|
||||||
|
let fill = `hsl(${h}, ${s}%, ${l}%)`;
|
||||||
this.el.setAttribute("fill", fill);
|
this.el.setAttribute("fill", fill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,18 +204,9 @@ namespace pxsim.visuals {
|
|||||||
function parseNeoPixelMode(modeStr: string): NeoPixelMode {
|
function parseNeoPixelMode(modeStr: string): NeoPixelMode {
|
||||||
const modeMap: Map<NeoPixelMode> = {
|
const modeMap: Map<NeoPixelMode> = {
|
||||||
"NeoPixelMode.RGB": NeoPixelMode.RGB,
|
"NeoPixelMode.RGB": NeoPixelMode.RGB,
|
||||||
"NeoPixelMode.RGBW": NeoPixelMode.RGBW,
|
"NeoPixelMode.RGBW": NeoPixelMode.RGBW
|
||||||
"*": NeoPixelMode.RGB,
|
|
||||||
};
|
};
|
||||||
let mode: NeoPixelMode = null;
|
return modeMap[modeStr] || NeoPixelMode.RGB;
|
||||||
for (let key in modeMap) {
|
|
||||||
if (key == modeStr) {
|
|
||||||
mode = modeMap[key];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
U.assert(mode != null, "Unknown NeoPixelMode: " + modeStr);
|
|
||||||
return mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NeoPixelView implements IBoardPart<NeoPixelState> {
|
export class NeoPixelView implements IBoardPart<NeoPixelState> {
|
||||||
|
Loading…
Reference in New Issue
Block a user