Is it possible to customize appearance? #1558
-
Hello, first thanks for this fully featured, open source tool, it's great that this exists. My goal in short: I'm trying to invert the color scheme, and fit it into a dark themed HTML site.
Only issue is, that the configuration needs Consider this example: import { RenderingResources } from '@coderline/alphatab'
const resources: Partial<RenderingResources> = {
barNumberColor: ... // How do I instantiate a Color? Where can I import it from?
barNumberFont: ... // Same here, how to I get access to the Font constructor?
} Thanks for any info in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Seems you might have mixed up the "strong typed settings" and the "initialization from JSON". But you're right that things can be a bit confusing for the start. As we're compiling alphaTab to C# and Kotlin, things inside alphaTab are rather strictly typed but in the web version we offer some more dynamic means to configure settings: Initialization via JSON object const api = new AlphaTabApi(document.querySelector("#alphaTab"), {
display: {
resources: {
staffLineColor: '#ffffff80',
barSeparatorColor: '#fff',
mainGlyphColor: '#fff',
secondaryGlyphColor: '#fff',
scoreInfoColor: '#fff',
barNumberColor: '#fff',
},
},
}) Initialization via Strong types import * as alphaTab from "@coderline/alphatab";
const settings = new alphaTab.Settings();
settings.display.resources.staffLineColor = new alphaTab.model.Color(0,0,0, 0x80),
settings.display.resources.barSeparatorColor = alphaTab.model.Color.fromJson('#fff')!,
const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab')!, settings); Changing settings later const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab')!, {});
api.settings.display.resources.staffLineColor = new alphaTab.model.Color(0,0,0, 0x80),
api.settings.display.resources.barSeparatorColor = alphaTab.model.Color.fromJson('#fff')!,
api.updateSettings(); I added #1561 to improve the clarity in this area. |
Beta Was this translation helpful? Give feedback.
Seems you might have mixed up the "strong typed settings" and the "initialization from JSON". But you're right that things can be a bit confusing for the start. As we're compiling alphaTab to C# and Kotlin, things inside alphaTab are rather strictly typed but in the web version we offer some more dynamic means to configure settings:
Initialization via JSON object