Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 901761c

Browse filesBrowse files
authored
Merge pull request #9685 from anntzer/trivial-aliases
Trivial aliases.
2 parents 266062e + 0cb3b36 commit 901761c
Copy full SHA for 901761c

File tree

Expand file treeCollapse file tree

1 file changed

+4
-13
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-13
lines changed

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+4-13Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,21 +251,11 @@ def to_hex(c, keep_alpha=False):
251251

252252
### Backwards-compatible color-conversion API
253253

254+
254255
cnames = CSS4_COLORS
255256
hexColorPattern = re.compile(r"\A#[a-fA-F0-9]{6}\Z")
256-
257-
258-
def rgb2hex(c):
259-
'Given an rgb or rgba sequence of 0-1 floats, return the hex string'
260-
return to_hex(c)
261-
262-
263-
def hex2color(c):
264-
"""
265-
Take a hex string *s* and return the corresponding rgb 3-tuple
266-
Example: #efefef -> (0.93725, 0.93725, 0.93725)
267-
"""
268-
return ColorConverter.to_rgb(c)
257+
rgb2hex = to_hex
258+
hex2color = to_rgb
269259

270260

271261
class ColorConverter(object):
@@ -328,6 +318,7 @@ def to_rgba_array(arg, alpha=None):
328318

329319
colorConverter = ColorConverter()
330320

321+
331322
### End of backwards-compatible color-conversion API
332323

333324

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.