diff --git a/.gitignore b/.gitignore
index 6aed95b..ecd62df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,3 +80,6 @@ target/
 
 # Generated by parse.py -p
 stats.prof
+
+# IDE
+.idea
diff --git a/html5lib/filters/sanitizer.py b/html5lib/filters/sanitizer.py
index dc80166..6315a1c 100644
--- a/html5lib/filters/sanitizer.py
+++ b/html5lib/filters/sanitizer.py
@@ -855,7 +855,7 @@ class Filter(base.Filter):
                                                 'padding']:
                 for keyword in value.split():
                     if keyword not in self.allowed_css_keywords and \
-                            not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):  # noqa
+                            not re.match(r"^(#[0-9a-fA-F]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):  # noqa
                         break
                 else:
                     clean.append(prop + ': ' + value + ';')

support uppercase hex characters in css color check
This covers adding support for uppercase hex characters in the css color check regex.

From #287:

> Adds uppercase check (A-F) in the css regex to pass css of the following format:
> border-top: 2px #DA4534 solid;
diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py
index e19deea..45046d5 100644
--- a/html5lib/tests/test_sanitizer.py
+++ b/html5lib/tests/test_sanitizer.py
@@ -113,3 +113,15 @@ def test_sanitizer():
         yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol,
                "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
                """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
+
+
+def test_lowercase_color_codes_in_style():
+    sanitized = sanitize_html("<p style=\"border: 1px solid #a2a2a2;\"></p>")
+    expected = '<p style=\"border: 1px solid #a2a2a2;\"></p>'
+    assert expected == sanitized
+
+
+def test_uppercase_color_codes_in_style():
+    sanitized = sanitize_html("<p style=\"border: 1px solid #A2A2A2;\"></p>")
+    expected = '<p style=\"border: 1px solid #A2A2A2;\"></p>'
+    assert expected == sanitized

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest pytest-expect mock
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
chardet==5.2.0
datrie==0.8.2
exceptiongroup==1.2.2
Genshi==0.7.9
-e git+https://github.com/html5lib/html5lib-python.git@d595d0a51253b8f9f5e1f14f15b285cadedf806e#egg=html5lib
iniconfig==2.1.0
lxml==5.3.1
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-expect==1.1.0
six==1.17.0
tomli==2.2.1
u-msgpack-python==2.8.0
webencodings==0.5.1

name: html5lib-python
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - chardet==5.2.0
      - datrie==0.8.2
      - exceptiongroup==1.2.2
      - genshi==0.7.9
      - iniconfig==2.1.0
      - lxml==5.3.1
      - mock==5.2.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-expect==1.1.0
      - six==1.17.0
      - tomli==2.2.1
      - u-msgpack-python==2.8.0
      - webencodings==0.5.1
prefix: /opt/conda/envs/html5lib-python

html5lib/tests/test_sanitizer.py::test_uppercase_color_codes_in_style
html5lib/tests/test_sanitizer.py::test_should_handle_astral_plane_characters html5lib/tests/test_sanitizer.py::test_should_allow_relative_uris html5lib/tests/test_sanitizer.py::test_invalid_data_uri html5lib/tests/test_sanitizer.py::test_invalid_ipv6_url html5lib/tests/test_sanitizer.py::test_data_uri_disallowed_type html5lib/tests/test_sanitizer.py::test_lowercase_color_codes_in_style
.gitignore html5lib/filters/sanitizer.py
.gitignore html5lib/filters/sanitizer.py