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

Add a color picker instead of a textbox for color selection #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SEVA77
Copy link

@SEVA77 SEVA77 commented Nov 8, 2024

Hello. I would like to suggest replacing the textbox with the browser color picker in Other Options....
To do this, simply change the type attribute in the textf element:

ei.textf.getElement().setAttribute("type", "color");

This simply replaces the <input type="text"> element with a <input type="color"> element.
The <input type="color"> element accepts values ​​in #rrggbb hexadecimal format. For GWT there is no difference between the type="color" and the type="text", so the getText() function in EditOptions.java:

String val = ei.textf.getText();

will return the value of the value attribute.

Here’s how it looks in Chromium and Firefox:

Chromium has its own implementation of color selection:

Firefox seems to be using system libraries. Firefox on Windows:

Firefox on Linux:

I haven’t tested the implementation in Safari but according to the specification this element is supported by all browsers.

I hope that I managed to explain everything clearly with my not very good English.

@pfalstad
Copy link
Owner

pfalstad commented Nov 9, 2024

This is great, I should have done it this way in the first place. But one advantage to the text boxes is that you can delete the text and it will go back to the original colors. (Someone filed an issue that there was no way to do this. It's not the most intuitive way but it works.). Any interest in adding a button to reset all the colors to the default?

@SEVA77
Copy link
Author

SEVA77 commented Nov 9, 2024

I think users in general may not know about this text box feature. Perhaps two buttons are needed to return default values: separately for colors and separately for other options excluding colors. Just to avoid such moments like “I would like to return default only the colors” and “I would like to return default everything except the colors".

@pfalstad
Copy link
Owner

pfalstad commented Nov 9, 2024

I'd be happy with just a button to reset the colors, since the other options can be reset more easily, or they get reset by loading a circuit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants