From e996655bd2eb03759a55048a089cff7348619646 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 11 Oct 2020 13:39:13 +0200 Subject: [PATCH] Shorten GraphicsContextWx.get_wxcolour. --- lib/matplotlib/backends/backend_wx.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 0e11e3ecfe60..55188b31002b 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -418,23 +418,7 @@ def set_joinstyle(self, js): def get_wxcolour(self, color): """Convert a RGB(A) color to a wx.Colour.""" _log.debug("%s - get_wx_color()", type(self)) - if len(color) == 3: - r, g, b = color - r *= 255 - g *= 255 - b *= 255 - return wx.Colour(red=int(r), green=int(g), blue=int(b)) - else: - r, g, b, a = color - r *= 255 - g *= 255 - b *= 255 - a *= 255 - return wx.Colour( - red=int(r), - green=int(g), - blue=int(b), - alpha=int(a)) + return wx.Colour(*[int(255 * x) for x in color]) class _FigureCanvasWxBase(FigureCanvasBase, wx.Panel):