Skip to content

Commit cde8dc5

Browse files
Longwei LiuLongwei Liu
authored andcommitted
Initial commit: ContrastCheck v0.1.0
0 parents  commit cde8dc5

24 files changed

Lines changed: 2557 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python-version: ['3.8', '3.9', '3.10', '3.11']
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Cache pip packages
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -e .
37+
pip install -r requirements-dev.txt
38+
39+
- name: Lint with flake8
40+
run: |
41+
# Stop the build if there are Python syntax errors or undefined names
42+
flake8 contrast_check/ --count --select=E9,F63,F7,F82 --show-source --statistics
43+
# Exit-zero treats all errors as warnings
44+
flake8 contrast_check/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
45+
46+
- name: Check code formatting with Black
47+
run: |
48+
black --check contrast_check/ tests/
49+
50+
- name: Check import sorting with isort
51+
run: |
52+
isort --check-only contrast_check/ tests/
53+
54+
- name: Type check with mypy
55+
run: |
56+
mypy contrast_check/ --ignore-missing-imports || true
57+
58+
- name: Run tests with pytest
59+
run: |
60+
pytest --cov=contrast_check --cov-report=xml --cov-report=term
61+
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v3
64+
with:
65+
file: ./coverage.xml
66+
flags: unittests
67+
name: codecov-umbrella
68+
fail_ci_if_error: false
69+
70+
build:
71+
runs-on: ubuntu-latest
72+
needs: test
73+
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- name: Set up Python
78+
uses: actions/setup-python@v4
79+
with:
80+
python-version: '3.10'
81+
82+
- name: Install build dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
pip install build twine
86+
87+
- name: Build package
88+
run: |
89+
python -m build
90+
91+
- name: Check package
92+
run: |
93+
twine check dist/*
94+
95+
- name: Upload artifacts
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: dist
99+
path: dist/

.gitignore

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
*.py,cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
db.sqlite3-journal
61+
62+
# Flask stuff:
63+
instance/
64+
.webassets-cache
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
target/
74+
75+
# Jupyter Notebook
76+
.ipynb_checkpoints
77+
78+
# IPython
79+
profile_default/
80+
ipython_config.py
81+
82+
# pyenv
83+
.python-version
84+
85+
# pipenv
86+
Pipfile.lock
87+
88+
# PEP 582
89+
__pypackages__/
90+
91+
# Celery stuff
92+
celerybeat-schedule
93+
celerybeat.pid
94+
95+
# SageMath parsed files
96+
*.sage.py
97+
98+
# Environments
99+
.env
100+
.venv
101+
env/
102+
venv/
103+
ENV/
104+
env.bak/
105+
venv.bak/
106+
107+
# Spyder project settings
108+
.spyderproject
109+
.spyproject
110+
111+
# Rope project settings
112+
.ropeproject
113+
114+
# mkdocs documentation
115+
/site
116+
117+
# mypy
118+
.mypy_cache/
119+
.dmypy.json
120+
dmypy.json
121+
122+
# Pyre type checker
123+
.pyre/
124+
125+
# IDEs
126+
.vscode/
127+
.idea/
128+
*.swp
129+
*.swo
130+
*~
131+
132+
# OS
133+
.DS_Store
134+
Thumbs.db
135+
136+
# PaddleOCR models and cache
137+
inference/
138+
*.pdparams
139+
*.pdiparams
140+
*.pdopt
141+
*.pdmodel
142+
143+
# Output files
144+
output/
145+
results/
146+
*.json
147+
*.txt
148+
!requirements*.txt
149+
!LICENSE
150+
!README.md

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Planned
11+
- Batch processing for multiple images
12+
- Visual output with highlighted text regions
13+
- Web interface
14+
- CI/CD integration
15+
- PDF document support
16+
- Color blindness simulation
17+
18+
## [0.1.0] - 2026-02-08
19+
20+
### Added
21+
- Initial release of ContrastCheck
22+
- OCR-based text detection using PaddleOCR
23+
- K-means color extraction for text and background
24+
- WCAG 2.1 AA and AAA compliance checking
25+
- Contrast ratio calculation based on WCAG guidelines
26+
- CLI interface with multiple output formats
27+
- Python API for programmatic access
28+
- JSON and text report generation
29+
- Support for multiple languages in OCR
30+
- GPU acceleration support
31+
- Comprehensive unit test suite
32+
- Documentation and examples
33+
- MIT License
34+
35+
### Features
36+
- Automatic text region detection
37+
- Intelligent color extraction
38+
- Detailed compliance reports
39+
- Easy-to-use command-line interface
40+
- Extensible Python API
41+
42+
[Unreleased]: https://github.com/yourusername/ContrastCheck/compare/v0.1.0...HEAD
43+
[0.1.0]: https://github.com/yourusername/ContrastCheck/releases/tag/v0.1.0

0 commit comments

Comments
 (0)