summaryrefslogtreecommitdiffstats
path: root/scripts/update_contrasts.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
commit1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch)
tree0299c6dd11d5edfa918a29b6456bc1875f1d288c /scripts/update_contrasts.py
parentInitial commit. (diff)
downloadpygments-upstream.tar.xz
pygments-upstream.zip
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xscripts/update_contrasts.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/update_contrasts.py b/scripts/update_contrasts.py
new file mode 100755
index 0000000..156bc5c
--- /dev/null
+++ b/scripts/update_contrasts.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+"""
+ Updates tests/contrast/min_contrasts.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Whenever you have improved the minimum contrast of a style you should run
+ this script, so that the test_contrasts.py test prevents future degredations.
+"""
+
+import os
+import sys
+
+# always prefer Pygments from source if exists
+srcpath = os.path.join(os.path.dirname(__file__), "..")
+if os.path.isdir(os.path.join(srcpath, "pygments")):
+ sys.path.insert(0, srcpath)
+
+import tests.contrast.test_contrasts
+
+tests.contrast.test_contrasts.test_contrasts(fail_if_improved=False)
+tests.contrast.test_contrasts.update_json()