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
Different-colored keys? #2
Comments
Hi @lassik! It seems to be a really nice feature to have. Now the color of the keys is hardcoded inside the CSS, but it would be great to control both pressed and unpressed keys colors from the model instead. I think having a If you wanted to use it with a function, you could do this when updating the model: colors =
List.range 0 127 -- MIDI note numbers
|> List.map (\note -> (note, noteColor note) )
|> Dict.fromList
newPianoModel = { pianoModel | colorOverrides = colors } To check if each key is pressed or unpressed you could check if the note number is member of the I'm a bit busy this days to code it, but I'll probably have some free time in a couple of weeks to give a look to this. Pull Request are also welcome :P |
Hi again! Sorry for the delay. I have been working on this feature, it seems to be finished now but I would like some feedback before publishing. I changed the approach a bit, but it is basically the same idea: having a dict allowing the users of the library to override the colors of some notes. I used the native Color type to specify the color. If you still interested, you could review this changes. The files examples/Basic.elm and examples/PlayMIDI.elm (this last one should be used with the examples/playmidi.html file) show a simple and a more complex way of using custom colors. To correctly run the PlayMIDI example you have to clone the repo https://github.com/mudcube/MIDI.js into the directory examples/bower_components/midi and to run Let me know if you have any problems or suggestions. |
Would you accept a feature to assign different colors to depressed keys? E.g. some of the depressed keys would be green, some red, and the remaining non-depressed keys would be black/white. Something like:
Or:
The text was updated successfully, but these errors were encountered: