I am working on a Sports card where I want the background to be based on a entity.attribute that is then used to build a dynamic filename for a colour value stored in a text file. The idea is we decode the team name and then lookup a file called (TeamName)_Home.txt that contains the Background colour value as a Hex string ie "#6c1d45".
This should then be passed to the Background colour option in the card config. I am using the ESPN Sports Tracker as the source of data, but it does not provide the Team Colour options for this particular League (Australian NRL) thus wanting to add the functionality.
I have tried with several options to get this to work, but I seem to fail with the file reference not being picked up, or the value not propagating correctly.
I have simplified the code right down to remove the team name logic and am now just testing with a fixed filename.
If I manually set the teamColor value to a Hex value it will work, but passing it the file name it will fail.
styles:
card:
- background-color: |
[[[
//let teamColor = `/local/media/NRL/BRI_HOME.txt`; // <- Not working
let teamColor = `#6c1d45`; // <- Working but not Dynamic
return `${teamColor}`;
]]]
I can browse to the file path in the browser and see the file contents, so I believe its not a permissions issue, but it just doesn't want to work.
With the teamColor forced to the Colour value string as per above code:
With the TeamColor set to pickup the value via the file containing the same value I get no errors or bad reference warnings, just a dark background:
So my question is.
a. Is it possible to pass a colour value in this way?
b. Is there any way to enable any more debugging to see why it might be failing?
thanks,
bill

