Skip to content

Commit

Permalink
device: remove dependency on webcolors
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Feb 9, 2024
1 parent 2351704 commit c8fc699
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 8 deletions.
8 changes: 1 addition & 7 deletions lib/logitech_receiver/settings_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
from struct import unpack as _unpack
from time import time as _time

import webcolors as _webcolors

from . import hidpp10 as _hidpp10
from . import hidpp20 as _hidpp20
from . import special_keys as _special_keys
Expand Down Expand Up @@ -1433,11 +1431,7 @@ class LEDControl(_Setting):
validator_options = {'choices': choices_universe}


colors = _NamedInts()
for c, v in _webcolors.CSS3_NAMES_TO_HEX.items():
v = int(v[1:], 16)
if v not in colors:
colors[v] = c
colors = _special_keys.COLORS
_LEDP = _hidpp20.LEDParam


Expand Down
139 changes: 139 additions & 0 deletions lib/logitech_receiver/special_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,3 +1249,142 @@ def persistent_keys(action_ids):

KEYS_KEYS_CONSUMER = persistent_keys([ACTIONID.Key, ACTIONID.Consumer])
KEYS_KEYS_MOUSE_HSCROLL = persistent_keys([ACTIONID.Key, ACTIONID.Mouse, ACTIONID.Hscroll])

COLORS = _UnsortedNamedInts({
# from Xorg rgb.txt,v 1.3 2000/08/17
'red': 0xff0000,
'orange': 0xffa500,
'yellow': 0xffff00,
'green': 0x00ff00,
'blue': 0x0000ff,
'purple': 0xa020f0,
'violet': 0xee82ee,
'black': 0x000000,
'white': 0xffffff,
'gray': 0xbebebe,
'brown': 0xa52a2a,
'cyan': 0x00ffff,
'magenta': 0xff00ff,
'pink': 0xffc0cb,
'maroon': 0xb03060,
'turquoise': 0x40e0d0,
'gold': 0xffd700,
'tan': 0xd2b48c,
'snow': 0xfffafa,
'ghost white': 0xf8f8ff,
'white smoke': 0xf5f5f5,
'gainsboro': 0xdcdcdc,
'floral white': 0xfffaf0,
'old lace': 0xfdf5e6,
'linen': 0xfaf0e6,
'antique white': 0xfaebd7,
'papaya whip': 0xffefd5,
'blanched almond': 0xffebcd,
'bisque': 0xffe4c4,
'peach puff': 0xffdab9,
'navajo white': 0xffdead,
'moccasin': 0xffe4b5,
'cornsilk': 0xfff8dc,
'ivory': 0xfffff0,
'lemon chiffon': 0xfffacd,
'seashell': 0xfff5ee,
'honeydew': 0xf0fff0,
'mint cream': 0xf5fffa,
'azure': 0xf0ffff,
'alice blue': 0xf0f8ff,
'lavender': 0xe6e6fa,
'lavender blush': 0xfff0f5,
'misty rose': 0xffe4e1,
'dark slate gray': 0x2f4f4f,
'dim gray': 0x696969,
'slate gray': 0x708090,
'light slate gray': 0x778899,
'light gray': 0xd3d3d3,
'midnight blue': 0x191970,
'navy blue': 0x000080,
'cornflower blue': 0x6495ed,
'dark slate blue': 0x483d8b,
'slate blue': 0x6a5acd,
'medium slate blue': 0x7b68ee,
'light slate blue': 0x8470ff,
'medium blue': 0x0000cd,
'royal blue': 0x4169e1,
'dodger blue': 0x1e90ff,
'deep sky blue': 0x00bfff,
'sky blue': 0x87ceeb,
'light sky blue': 0x87cefa,
'steel blue': 0x4682b4,
'light steel blue': 0xb0c4de,
'light blue': 0xadd8e6,
'powder blue': 0xb0e0e6,
'pale turquoise': 0xafeeee,
'dark turquoise': 0x00ced1,
'medium turquoise': 0x48d1cc,
'light cyan': 0xe0ffff,
'cadet blue': 0x5f9ea0,
'medium aquamarine': 0x66cdaa,
'aquamarine': 0x7fffd4,
'dark green': 0x006400,
'dark olive green': 0x556b2f,
'dark sea green': 0x8fbc8f,
'sea green': 0x2e8b57,
'medium sea green': 0x3cb371,
'light sea green': 0x20b2aa,
'pale green': 0x98fb98,
'spring green': 0x00ff7f,
'lawn green': 0x7cfc00,
'chartreuse': 0x7fff00,
'medium spring green': 0x00fa9a,
'green yellow': 0xadff2f,
'lime green': 0x32cd32,
'yellow green': 0x9acd32,
'forest green': 0x228b22,
'olive drab': 0x6b8e23,
'dark khaki': 0xbdb76b,
'khaki': 0xf0e68c,
'pale goldenrod': 0xeee8aa,
'light goldenrod yellow': 0xfafad2,
'light yellow': 0xffffe0,
'light goldenrod': 0xeedd82,
'goldenrod': 0xdaa520,
'dark goldenrod': 0xb8860b,
'rosy brown': 0xbc8f8f,
'indian red': 0xcd5c5c,
'saddle brown': 0x8b4513,
'sienna': 0xa0522d,
'peru': 0xcd853f,
'burlywood': 0xdeb887,
'beige': 0xf5f5dc,
'wheat': 0xf5deb3,
'sandy brown': 0xf4a460,
'chocolate': 0xd2691e,
'firebrick': 0xb22222,
'dark salmon': 0xe9967a,
'salmon': 0xfa8072,
'light salmon': 0xffa07a,
'dark orange': 0xff8c00,
'coral': 0xff7f50,
'light coral': 0xf08080,
'tomato': 0xff6347,
'orange red': 0xff4500,
'hot pink': 0xff69b4,
'deep pink': 0xff1493,
'light pink': 0xffb6c1,
'pale violet red': 0xdb7093,
'medium violet red': 0xc71585,
'violet red': 0xd02090,
'plum': 0xdda0dd,
'orchid': 0xda70d6,
'medium orchid': 0xba55d3,
'dark orchid': 0x9932cc,
'dark violet': 0x9400d3,
'blue violet': 0x8a2be2,
'medium purple': 0x9370db,
'thistle': 0xd8bfd8,
'dark gray': 0xa9a9a9,
'dark blue': 0x00008b,
'dark cyan': 0x008b8b,
'dark magenta': 0x8b008b,
'dark red': 0x8b0000,
'light green': 0x90ee90,
})
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def _data_files():
python_requires='>=3.7',
install_requires=[
'evdev (>= 1.1.2) ; platform_system=="Linux"',
'webcolors',
'pyudev (>= 0.13)',
'PyYAML (>= 3.12)',
'python-xlib (>= 0.27)',
Expand Down

0 comments on commit c8fc699

Please sign in to comment.