Skip to content

Commit

Permalink
Allow decimal numbers in HSV color format
Browse files Browse the repository at this point in the history
  • Loading branch information
MisanthropicBit committed Jan 27, 2021
1 parent e2edf05 commit c6541ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions colorise/cluts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
)
_HEX_RE = re.compile(r'^(0x|#)?(([0-9a-fA-F]{2}){3})$')
_HSV_RE = re.compile(
r'^(hsv)\((\d+'
r'^(hsv)\((\d+(\.\d+)?'
+ _DELIMITER
+ r'\s*\d+'
+ r'\s*\d+(\.\d+)?'
+ _DELIMITER
+ r'\s*\d+)\)$'
+ r'\s*\d+(\.\d+)?)\)$'
)
_HLS_RE = re.compile(
r'^(hls)\((\d+(\.\d+)?'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_valid_truecolor_cprint_output(test_stdout):
'\x1b[0m\x1b[38;2;166;150;255mHello\x1b[0m' + os.linesep
),
(
{'fg': 'hsv(249;41;100)'},
{'fg': 'hsv(249.2;41.0;100.078)'},
'\x1b[0m\x1b[38;2;166;150;255mHello\x1b[0m' + os.linesep
),
(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_valid_truecolor_fprint_output(test_stdout):
'\x1b[0m\x1b[38;2;166;150;255mHello\x1b[0m' + os.linesep),
('fg=0xa696ff',
'\x1b[0m\x1b[38;2;166;150;255mHello\x1b[0m' + os.linesep),
('fg=hsv(249;41;100)',
('fg=hsv(249.2;41.0;100.078)',
'\x1b[0m\x1b[38;2;166;150;255mHello\x1b[0m' + os.linesep),
('fg=rgb(167;151;255)',
'\x1b[0m\x1b[38;2;167;151;255mHello\x1b[0m' + os.linesep),
Expand Down

0 comments on commit c6541ad

Please sign in to comment.