Add limited support for named colors

Resolves #41
This commit is contained in:
Anthony Sottile
2020-03-17 11:00:53 -07:00
parent 414adffa9b
commit 08638f990c
2 changed files with 23 additions and 1 deletions

15
tests/color_test.py Normal file
View File

@@ -0,0 +1,15 @@
import pytest
from babi.color import Color
@pytest.mark.parametrize(
('s', 'expected'),
(
('#1e77d3', Color(0x1e, 0x77, 0xd3)),
('white', Color(0xff, 0xff, 0xff)),
('black', Color(0x00, 0x00, 0x00)),
),
)
def test_color_parse(s, expected):
assert Color.parse(s) == expected