Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported format for color #387

Closed
garthholmes opened this issue Aug 16, 2020 · 8 comments · Fixed by #543
Closed

Unsupported format for color #387

garthholmes opened this issue Aug 16, 2020 · 8 comments · Fixed by #543
Assignees
Labels
area-documentation Related to documentation and sample code area-rendering Everything related to the rendering platform-javascript Related to the JavaScript version of alphaTab state-needs-investigation type-bug 🕷️
Milestone

Comments

@garthholmes
Copy link

Hi,

I am getting the error "unsupported format for color" when using version 1.0.1 of Alphatab.

Version used: 1.0.1
Platform used: JavaScript
Rendering engine used: SVG
Chrome Latest
Windows
Link to your project: Testing on Localhost, but will provide more information, and a test link if required.

Thank you

Expected Results

Allow colors to be used, as per AlphaTab documentation.

Observed Results

Alphatab not proceeding with loading of .gp file

Steps to Reproduce (for bugs)

  1. Error coming from Alphatab.JS, as per Title
  2. Tried color from script and from data attribute
  3. Neither data attribute nor script work, project only works when color information is removed

Possible Solution

Remove color information, but then it is not possible to see anything, as background color precludes

@Danielku15 Danielku15 self-assigned this Aug 16, 2020
@Danielku15 Danielku15 added type-bug 🕷️ area-documentation Related to documentation and sample code area-rendering Everything related to the rendering platform-javascript Related to the JavaScript version of alphaTab priority-high state-needs-investigation labels Aug 16, 2020
@Danielku15 Danielku15 added this to the 1.1 milestone Aug 16, 2020
@Danielku15
Copy link
Member

Can you provide a concrete example on when this error occurs? If possible a jsFiddle or example link showing the issue..
The related parsing code for colors is placed here:

public static fromJson(json: unknown): Color | null {

Generally the conversion code is quite simple, this means there is very likely something special to your color definition.

The docs mention that any CSS compliant string like #RGB, #RGBA, #RRGGBB, #RRGGBBAA, rgb(r,g,b) and rgba(r,g,b,a) is supported. It might be true that CSS supports more (like hsl() and hsla()) and the docs might not be 100% correct:
https://alphatab.net/docs/reference/settings/display/resources#colors

@garthholmes
Copy link
Author

Hi Daniel,

I will get to that, but just to add some information, I am using the latest version of JQuery as well if that would make a difference.

Regards

@Danielku15
Copy link
Member

jQuery should not have any impact on alphaTab. The jQuery support is just a very thin layer which maps calls down to an alphaTab API object which is plain JavaScript. It's most likely something is wrong with the values you're passing in. Once you provided an example we can investigate further.

@Danielku15
Copy link
Member

@Nascent Any update here? Otherwise I will close this issue due to inactivtiy.

@Danielku15
Copy link
Member

Closing due to inactivity.

@WindBise
Copy link

WindBise commented Sep 1, 2024

I have came across this issue too. Seems the doc is miss leading.
https://alphatab.net/docs/reference/settings/display/resources/
image
I use this syntax to update colors in setting like below.
this.state.api.settings.display.resources.barNumberColor = 'rgb(0,0,0)'
this.state.api.updateSettings();
And then i got error
image
It seems that color setting is already a object
image
So how can i update the color setting ?

@WindBise
Copy link

WindBise commented Sep 1, 2024

Found a way to fix this. Change color by set raw.
Like setting color to white just use code below:
settings.display.resources.barNumberColor.raw = -1;
And the rgba to raw should calculate like:
raw = ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)

@Danielku15
Copy link
Member

@WindBise See #1558 (comment) for more details on that topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-documentation Related to documentation and sample code area-rendering Everything related to the rendering platform-javascript Related to the JavaScript version of alphaTab state-needs-investigation type-bug 🕷️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants