Skip to content

Commit

Permalink
work on RGB_COLORS.
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Nov 15, 2023
1 parent 5aa629c commit 011ec6e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions aiidalab_widgets_base/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,20 @@
"Mt": 1.75,
}

RGB_colors = {
"red": [1, 0, 0],
"green": [0, 1, 0],
"blue": [0, 0, 1],
"yellow": [1, 1, 0],
"cyan": [0, 1, 1],
"magenta": [1, 0, 1],
"white": [1, 1, 1],
"black": [0, 0, 0],
"grey": [0.5, 0.5, 0.5],
"purple": [0.5, 0, 0.5],
"orange": [1, 0.5, 0],
"brown": [0.5, 0.25, 0],
"pink": [1, 0.75, 0.8],
"lime": [0.75, 1, 0],
"olive": [0.5, 0.5, 0],
RGB_COLORS = {
"red": (1, 0, 0),
"green": (0, 1, 0),
"blue": (0, 0, 1),
"yellow": (1, 1, 0),
"cyan": (0, 1, 1),
"magenta": (1, 0, 1),
"white": (1, 1, 1),
"black": (0, 0, 0),
"grey": (0.5, 0.5, 0.5),
"purple": (0.5, 0, 0.5),
"orange": (1, 0.5, 0),
"brown": (0.5, 0.25, 0),
"pink": (1, 0.75, 0.8),
"lime": (0.75, 1, 0),
"olive": (0.5, 0.5, 0),
}
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from IPython.display import clear_output, display
from matplotlib.colors import to_rgb

from .dicts import Colors, Radius, RGB_colors
from .dicts import RGB_COLORS, Colors, Radius
from .misc import CopyToClipboardButton, ReversePolishNotation
from .utils import ase2spglib, list_to_string_range, string_range_to_list

Expand Down Expand Up @@ -577,15 +577,15 @@ def povray_cylinder(v1, v2, radius, atom, color):

def cylinder(v1, v2, radius, atom, color):
color = (
colors.jmol_colors[atom.number].tolist()
tuple(colors.jmol_colors[atom.number].tolist())
if color == "element"
else RGB_colors[color]
else RGB_COLORS[color]
)
return (
"cylinder",
tuple(v1),
tuple(v2),
tuple(color),
color,
radius,
)

Expand Down

0 comments on commit 011ec6e

Please sign in to comment.