How do you control text color of HolographicButton?
Button itself has backMaterial and frontMaterial and that works as expected.
Text can be a string or a TextBlock set as content and color can be set there, but no matter what alpha values are chosen, its always blended with background making it incredibly difficult to read.
And this happens even if buttons front and back material have alpha=1 - basically button becomes opaque, but text color is still blended with the background!
I’ve tried playing with outlineColor and shadowColor for TextBlock and they have the same issue.
Note that blending happens at the time of the first render only, it is not updated when scene is rotated.
createTextBlock(text: string) {
const textBlock = new TextBlock();
textBlock.text = text.replace(' ', '\n').toUpperCase();
textBlock.color = Theme.btnFontColor;
textBlock.alpha = 1;
textBlock.fontFamily = 'Lato';
textBlock.fontSize = 40;
window.text = textBlock;
return textBlock;
}
createButton(name: string, callback: Callback) {
const btn = new HolographicButton(name, true);
btn.onPointerDownObservable.add(() => callback(this.person));
this.panel.addControl(btn);
btn.backMaterial.albedoColor = Color3.FromHexString(Theme.btnBackColor);
btn.backMaterial.alpha = Theme.btnBackAlpha;
btn.frontMaterial.albedoColor = Color3.FromHexString(Theme.btnHighlighColor);
btn.frontMaterial.hoverColor = Color4.FromHexString(Theme.btnHighlighColor);
btn.frontMaterial.alpha = Theme.btnHighlightAlpha;
btn.content = this.createTextBlock(name);
window.panel = this.panel;
return btn;
}