Skip to content

Commit

Permalink
ADD: expose plot.unambiguous_color()
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Jun 28, 2021
1 parent 410ed15 commit fad9896
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ Color tools for plotting:
plot.colors_for_categorial
plot.colors_for_oneway
plot.colors_for_twoway
plot.unambiguous_color
plot.soft_threshold_colormap
plot.two_step_colormap
plot.Style
Expand Down
12 changes: 12 additions & 0 deletions eelbrain/_colorspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ def make_seq_cmap(seq, val, name):


def unambiguous_color(color: str, lightness: float = None, chroma: float = None):
"""Generate an `unambiguous color <https://jfly.uni-koeln.de/html/color_blind/#pallet>`_
Prameters
---------
color
Color name, one of: black, orange, sky blue, bluish green, yellow,
blue, vermilion, reddish purple.
lightness
Adjust the lightness (in percent).
chroma
Adjust the saturation (in percent).
"""
r, g, b = UNAMBIGUOUS_COLORS[color]
l, c, h = rgb_to_lch(r, g, b)
if lightness is not None:
Expand Down
2 changes: 1 addition & 1 deletion eelbrain/plot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Plotting for data-objects"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>

from .._colorspaces import two_step_colormap
from .._colorspaces import two_step_colormap, unambiguous_color

from ._base import reset_rc, subplots
from ._colors import ColorBar, ColorGrid, ColorList
Expand Down

0 comments on commit fad9896

Please sign in to comment.