-
Notifications
You must be signed in to change notification settings - Fork 229
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
[feature] improved multilingual color input #135
Comments
These ideas you present, are great! 👍 I just have a few comments about some details.
By accepting German codes as input, I assume requests for supporting additional languages will arrive. As more languages can be supported, it might be hard to avoid ambiguity unless adding a language prefix (e.g. It is already a small parsing ambiguity for the German color
Do you mean that you consider removing the |
True. This is an aspect to keep in mind.
I'm seeing another problem, that hex colors such as
Both would take care of the "triple german ivory" edge case ;-)
Let me think about the implications some more. |
From a user perspective I would prefer to specify some colors on my own, but not necessary use other names for it. For example the default green is far to bright in my opinion. Also when having striped / banded colors the defaulted ones might not go well with each other (for example yellow / green). I would therefore propose to split naming of the color from the actual color name / hexcode. The user could than use a color name and optionally provide a hexcode to define the color. If nothing is provided we can still use common namings to provide a default color. Next I would define on global or wire level which color naming scheme to use to avoid ambiguities. I think it would be pretty straight forward to say something like In fact your That gives 3 scenarios:
With this 3 settings everything is fully configurable and the user can use his own translation until there is a default. Also he could use different naming for multicolor ( To make it less verbose when using multiple wires we can also give the user the possibility to define his own color_code in a separate |
@SnowMB
My own guess is that most users just want to enter a color name, have it work in a predictable way, and have a nice looking output. The use of HTML names and hex codes should probably be the exception, for when someone really really needs a lavender blush colored cable.
This tells me we need to tweak the pallette to get the colors to look right. I agree that the GNYE combo is not the best at the moment. And there are some color combinations that just always look terrible, both on-screen and in real life... red and blue striped cables, ugh! My initial proposal, of making the existing |
@kvid Obviously some translation requests might come in, but that's nothing that |
If we make the current GN darker (as I think is a good idea), e.g. |
This was requested by designer2k2 in wireviz#219 for bgcolor usage. It has also been discussed in wireviz#135. The input validation is more detailed to help the user identifying and locating invalid values. The wire color padding is now done on the output to cover different input alternatives.
This was requested by designer2k2 in wireviz#219 for bgcolor usage. It has also been discussed in wireviz#135. The input validation is more detailed to help the user identifying and locating invalid values. The wire color padding is now done on the output to cover different input alternatives.
This was requested by designer2k2 in wireviz#219 for bgcolor usage. It has also been discussed in wireviz#135. The input validation is more detailed to help the user identifying and locating invalid values. The wire color padding is now done on the output to cover different input alternatives.
This was requested by designer2k2 in wireviz#219 for bgcolor usage. It has also been discussed in wireviz#135. The input validation is more detailed to help the user identifying and locating invalid values. The wire color padding is now done on the output to cover different input alternatives.
This was requested by designer2k2 in wireviz#219 for bgcolor usage. It has also been discussed in wireviz#135. The input validation is more detailed to help the user identifying and locating invalid values. The wire color padding is now done on the output to cover different input alternatives.
The work that is ongoing in #251 will close this issue (see the new The option to take German color codes as input will be discarded, to prevent collisions with any future language expansions, and to keep the WireViz YAML syntax purely in English. |
Example
The following YAML input:
should be valid, and produce the following output:
Yes, tomato should be an accepted color because it's part of the official HTML color names 🍅
Motivation
Currently,
wv_colors.py
includes list of german color codes (e.g.ge
for gelb=yellow), as well as full english color names, but there is no direct way to use them. It would be nice if German users could directly use the german color codes; the direct HTML color and hex options give unlimited flexibility to anybody who needs it; anybody who does not like abbreviations is not forced to use them, or see them in the output.My proposal is to allow the following inputs:
I've chosen to exclude the
#
in the hex colors because YAML treats it as a comment delimiter, and\#FF0000
is less readableThe HTML color entities do not cause extra work because GraphViz understands them natively.
Implementation
The implementation should be quite straightforward.
In addition to a cable's
colors
list, a secondhtmlcolors
list (or similar) is needed. Then, a simple parsing function parses the user's input, checking whether it's included in one of the color codes, and setting the appropriatehtmlcolor
, i.e. mappingRD
to#ff0000
andge
to#ffff00
, adding the missing#
if a hex color was specified, and simply passing the input if it is neither of these (tomato
). If the input is a completely unknown color, it will be rendered black (default GraphViz behavior) but the label will still show the input.This means that the color parsing would happen in the cable's
__post_init__()
function, and all the GraphViz code generation would no longer use thetranslate_color()
function, but read straight from thehtmlcolors
list.Multicolor wires should be easy to include as well:
Keep allowing four- and six- letter combinations as input (
GNYE
,gnge
, and possibly even00FF00/FFFF00
andgreen/yellow
) and expand them to a list while parsing.The rendering code would check if the respective item in
htmlcolors
is a string (single color) or list (multicolor) and react accordingly.The text was updated successfully, but these errors were encountered: