8000 Add solarized palette as named colors by josesho · Pull Request #11927 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add solarized palette as named colors #11927

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

Closed
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
63b8b65
add Solarized palette
josesho Aug 24, 2018
befad3c
add import solarized colors
josesho Aug 24, 2018
b1e9b57
add solarized colors to named color example
josesho Aug 24, 2018
22f03ee
add Solarized palette writeup to whats_new
josesho Aug 24, 2018
1e5ec15
fix typo
josesho Aug 24, 2018
b329729
align dict with above dict; change "solarized-" to "solarized:"
josesho Aug 24, 2018
1dc142d
align import
josesho Aug 24, 2018
c5cd04b
align within parenthesis
josesho Aug 24, 2018
4f766d3
fix reference to solarized colors
josesho Aug 24, 2018
e37e84c
update named colors example
8000 josesho Aug 25, 2018
72716ab
align swatches; standardize swatch size and font size
josesho Aug 26, 2018
cec44bb
better control of grid layout
josesho Aug 27, 2018
57c7d00
fix missing `mcolors.`
josesho Aug 27, 2018
da7d5be
code lint
josesho Aug 27, 2018
36d14cb
removed unused functions in references
josesho Aug 27, 2018
7d9f670
add descriptions as inline comments
josesho Aug 27, 2018
6138137
revert as per issuecomment-416700193
josesho Aug 29, 2018
39eec2a
Merge branch 'add-solarized-palette-as-named-colors' of https://githu…
josesho Aug 29, 2018
59761d7
moved solarized writeup from whats_new to next_whats_new
josesho Aug 29, 2018
d4f109e
add mention of Solarized to colors.py module docstring
josesho Aug 29, 2018
fa9fda5
fix typo
josesho Aug 29, 2018
cf70a3d
fix another typo
josesho Aug 29, 2018
88c05e7
fix identation in docstring
josesho Aug 29, 2018
6dbfb50
fix broekn rst hyperlink
josesho Aug 29, 2018
00f5c60
add solarized description to docstring
josesho Aug 30, 2018
3dabeae
uncomment next_whats_new TOC chunk
josesho Aug 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/users/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ wrap around, they are a good choice for cyclic data such as phase
angles, compass directions, or time of day. Like *viridis*, *twilight* is
perceptually uniform and colorblind friendly.

Add Solarized palette to named matplotlib colors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-------------------------------------------------
Ethan Schoonover's `Solarized palette <https://ethanschoonover.com/solarized/__`
is now implemented as named matplotlib colors. Comprising of 16 colors, the
colors can be accesseed by appending 'solarized-' to their name, e.g.
`solarized-cyan` refers to cyan from the Solarized palette.


Don't automatically rename duplicate file names
-----------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion examples/color/named_colors.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from matplotlib import colors as mcolors


colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS)
colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS,
**mcolors.SOLARIZED_COLORS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align the continued line with the inside I’d the parentheses, I.e. remove two spaces.


# Sort colors by hue, saturation, value and name.
by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name)
Expand Down
23 changes: 23 additions & 0 deletions lib/matplotlib/_color_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,3 +1142,26 @@
'whitesmoke': '#F5F5F5',
'yellow': '#FFFF00',
'yellowgreen': '#9ACD32'}

# These are the 16 colors of the Solarized palette by Ethan Schoonover.
# See https://ethanschoonover.com/solarized/
# License: https://github.com/altercation/solarized/blob/master/LICENSE
# Copyright (c) 2011 Ethan Schoonover
SOLARIZED_COLORS = {
'solarized-base03': '#002b36',
Copy link
Contributor
@anntzer anntzer Aug 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespacing method we use (cf. xkcd, tab) is "solarized:base03" (colon), not "solarized-base03" (dash).
Anyone can dismiss this once handled.

'solarized-base02': '#073642',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align the color values with the color values of the CSS colors above.

'solarized-base01': '#586e75',
'solarized-base00': '#657b83',
'solarized-base0': '#839496',
'solarized-base1': '#93a1a1',
'solarized-base2': '#eee8d5',
'solarized-base3': '#fdf6e3',
'solarized-yellow': '#b58900',
'solarized-orange': '#cb4b16',
'solarized-red': '#dc322f',
'solarized-magenta': '#d33682',
'solarized-violet': '#6c71c4',
'solarized-blue': '#268bd2',
'solarized-cyan': '#2aa198',
'solarized-green': '#859900',
}
4 changes: 3 additions & 1 deletion lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@

import numpy as np
import matplotlib.cbook as cbook
from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For multi-line imports we prefer enclosing in brackets over line-continuation characters, i.e.

from ._color_data import (BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS,
                          XKCD_COLORS, SOLARIZED_COLORS)

XKCD_COLORS, SOLARIZED_COLORS


class _ColorMapping(dict):
Expand All @@ -69,6 +70,7 @@ def __delitem__(self, key):

_colors_full_map = {}
# Set by reverse priority order.
_colors_full_map.update(SOLARIZED_COLORS)
_colors_full_map.update(XKCD_COLORS)
_colors_full_map.update({k.replace('grey', 'gray'): v
for k, v in XKCD_COLORS.items()
Expand Down
0