-
Notifications
You must be signed in to change notification settings - Fork 130
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
Sequencer: changing individual block colours? #121
Comments
An approach I have come up with is:
|
Yes, you should be able to do this in a more straightforward way. The sequencer is designed so that each cell is its own square nexusui button, essentially. In theory, you ought to be able to do the following: |
That sounds great - thanks very much! |
Reviewing the implementation, the current type of inheritance was done for a reason. Each cell uses the sequencer's colors, rather than the button's own colors. Here's the problem that occurs if each cell has its own defined set of colors --- Let's say a user creates a fairly large sequencer (100x100) and sets its accent color to red. When the page loads, the program must loop through each cell to set its color. This would be a loop of 10,000 svg style calls, which creates a large delay in loading the page. It can be many seconds before the nexusui elements render. This is problematic, and the solution I chose was to use 1 set of inherited colors for all cells in the sequencer. I will keep thinking about this and consider if there are some conditional ways to make cells more customizable while avoiding that kind of loading issue. |
So at present when a sequencer grid of 100x100 loads, you do not need to loop and set colors because they are simply rendering the same SVG for all blocks - e.g. with an accent fill colour of red?
|
Also I have noticed that if we do
and then click on the cell, the above color is not persisted. That is the color #51575Bis not persisted and the cell goes back to its previous color. |
Is it possible to change color of a single block within a sequencer to a different color than the accent?
Can anyone steer me in the right direction?
I am going to try setting the fill attribute on the svg elements within each span tag via js, but I wondered what the best/recommended approach is?
<span style="position: absolute; left: 0px; top: 64.1667px; width: 64.375px; height: 64.1667px;"><svg width="64.375" height="64.16666666666667" style="top: 0px; left: 0px; position: absolute; cursor: pointer;"><rect x="1" y="1" width="62.375" height="62.16666666666667" fill="#ff0000"></rect></svg></span>
The text was updated successfully, but these errors were encountered: