Opened 140 html compliant colors - #4
Conversation
|
Just noted a fix required on my L7 - recognizing local file on module import. |
|
thanks for this PR @jdbodyfelt! I don't have any CI set up, are you using this branch without issues? If so I will quickly review and merge |
|
Hi! Maybe hold off on the merge - the file import of the namelist isn't working as a module yet. I'll either spend some time in figuring out how to path that right, or I'll just hard-code the namelist direct into module.py... |
|
@nabsabraham - got around to a module-friendly fix using Please check this branch yourself, and then feel free to merge! |
|
@nabsabraham @ba-tno - I'm unable to add reviewers to this PR. If someone could pick that up and review? Thank you! |
There was a problem hiding this comment.
This is my first review, so not sure what is expected, hope my comments are helpful.
The core issue is that not all 140 colors are rendered by Edotor (click for example). I've marked them each with a review comment.
This is an Edotor issue, as both the Graphviz binary as well as another web-renderer (Magjac Graphviz Visual Editor) show them without any problem.
You could either remove the non-working colors, or suggest the Magjac renderer instead of Edotor. The Magjac renderer is also referred to in the Graphviz docs via the "Edit in Playground" links.
| "families": ["red"] | ||
| }, | ||
| { | ||
| "name": "DARKRED", |
| "families": ["purple", "orchid"] | ||
| }, | ||
| { | ||
| "name": "FUCHSIA", |
| "families": ["purple", "medium"] | ||
| }, | ||
| { | ||
| "name": "REBECCAPURPLE", |
| "families": ["purple", "dark", "orchid"] | ||
| }, | ||
| { | ||
| "name": "DARKMAGENTA", |
| "families": ["green"] | ||
| }, | ||
| { | ||
| "name": "LIME", |
| "families": ["gray"] | ||
| }, | ||
| { | ||
| "name": "DARKGRAY", |
| @@ -27,7 +34,9 @@ def __init__(self, table, table_name, **kwargs): | |||
| self.align = 'left' | |||
| self.font_color = 'grey60' | |||
| self.bg_color = kwargs.get('bg_color', 'grey') | |||
There was a problem hiding this comment.
The default color grey (British spelling) is not part of the self.html_colors list, gray (US spelling) is.
| self.bg_color = kwargs.get('bg_color', 'grey') | ||
| bg_colors = ['lightblue', 'skyblue', 'pink', 'lightyellow', 'grey', 'gold'] | ||
| bg_colors = self.html_colors #['lightblue', 'skyblue', 'pink', 'lightyellow', 'grey', 'gold'] | ||
| # TODO: Set font_color complementary to bg_color |
There was a problem hiding this comment.
Would be nice indeed! Two methods I can think if (perhaps you already have an idea how to do this):
- you can find the RGB of a complementary color from using this method and then find the closest available color in the
colors.jsonfile. - you can create a dictionary once that lists the complementary color for each key in
colors.jsonand do a lookup there.
| src.render(path.with_suffix(''), format=fmt) | ||
| print(f'image written to {filename}') | ||
| else: | ||
| url='https://edotor.net/' |
There was a problem hiding this comment.
Perhaps add http://magjac.com/graphviz-visual-editor/ as an option as well? Given that Edotor does not render all the HTML colors from the list.
| install_requires = [ | ||
| 'pandas' | ||
| ] | ||
| python_requires=">=3.6", |
There was a problem hiding this comment.
Not sure how this works, but given that pandas requires python >=3.8 already, perhaps best to write that here as well? Or does this refer to the python version this "bare" package (without dependencies) would require?
I added a JSON list found online of the 140 html-compliant (CSS3) color names, and modified the color protection to use this list within
module.py. I tested it with two of my go-to colors (salmon & dodgerblue). Rendered fine at edotor.net.OTHER COLORS SHOULD BE CHECKED!