From 1711b5eb62aa0e19d4b4f88a902189454306caec Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Tue, 13 Aug 2019 15:59:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Support=20displaCy=20user=20colo?= =?UTF-8?q?rs=20via=20entry=20point=20(#4113)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spacy/displacy/render.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/displacy/render.py b/spacy/displacy/render.py index 86b933eef..c2a903a56 100644 --- a/spacy/displacy/render.py +++ b/spacy/displacy/render.py @@ -5,7 +5,7 @@ import uuid from .templates import TPL_DEP_SVG, TPL_DEP_WORDS, TPL_DEP_ARCS, TPL_ENTS from .templates import TPL_ENT, TPL_ENT_RTL, TPL_FIGURE, TPL_TITLE, TPL_PAGE -from ..util import minify_html, escape_html +from ..util import minify_html, escape_html, get_entry_points DEFAULT_LANG = "en" DEFAULT_DIR = "ltr" @@ -237,6 +237,9 @@ class EntityRenderer(object): "CARDINAL": "#e4e7d2", "PERCENT": "#e4e7d2", } + user_colors = get_entry_points("spacy_displacy_colors") + for user_color in user_colors.values(): + colors.update(user_color) colors.update(options.get("colors", {})) self.default_color = "#ddd" self.colors = colors