Skip to content

Commit d44594a

Browse files
committed
added dark mode feature which closes #1
1 parent 78b3057 commit d44594a

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## PyPI Chart Badge
1+
## PyPI Chart Badge [![pyaction](https://img.shields.io/badge/PyAction-black?style=for-the-badge&logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNjAwIj4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLmNscy0xIHsKICAgICAgICBmaWxsOiAjZmZmOwogICAgICAgIGZpbGwtcnVsZTogZXZlbm9kZDsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPGcgaWQ9IlNWR1JlcG9faWNvbkNhcnJpZXIiIGRhdGEtbmFtZT0iU1ZHUmVwbyBpY29uQ2FycmllciI+CiAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0zNjAuNywyMjAuNDNsMjMzLjUzLDI1Mi4zMkwzMzEuNTksMTguODksNS45Niw1ODEuM0gzNzUuMmwtMjI0LjMxLTY1LjUzYy0xMi42MS0zLjY5LTE3Ljc5LTE4Ljc0LTEwLjA3LTI5LjRMMzMxLjM5LDIyMi4xOGM2Ljk4LTkuNzIsMjEuMTgtMTAuNTcsMjkuMy0xLjc0WiIvPgogIDwvZz4KPC9zdmc+)](https://pyaction.imsadra.me/)
22

33
This action allows you to create and put fancy-looking chart badges indicating the recent download rate of your Python packages in the README.
44

@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/checkout@v4
3232

3333
- name: Updating the badge
34-
uses: lnxpy/pypi-chart-badge@v1.3
34+
uses: lnxpy/pypi-chart-badge@v1.4
3535
with:
3636
package_name: '<PACKAGE-NAME>'
3737

@@ -49,15 +49,16 @@ After each run, you'll have your badge stored in `.pypi_chart/badge.svg` of your
4949
5050
### Options
5151

52-
| Option | Default value | Description | Required |
53-
| :------------: | :------------: |-------------------------------------------------------------------------------------------------|:--------:|
54-
| `package_name` | - | The Package name | Yes |
55-
| `badge_width` | `60` | Badge width size in pixels | No |
56-
| `badge_height` | `20` | Badge height size in pixels | No |
57-
| `badge_color` | `'#4492F9'` | Badge plot color (HEX or CSS color names) | No |
58-
| `days_limit` | `15` | The amount of selected days | No |
59-
| `output_path` | `.pypi_chart/` | Badge file path directory | No |
60-
| `file_name` | `badge.svg` | Badge file name and extension (`.png`, `.jpg`, `.jpeg`, `.webp`, and `.pdf` are also supported) | No |
52+
| Option | Default value | Description | Required |
53+
| :-----------------: | :------------: |-------------------------------------------------------------------------------------------------|:--------:|
54+
| `package_name` | - | The Package name | Yes |
55+
| `badge_width` | `60` | Badge width size in pixels | No |
56+
| `badge_height` | `20` | Badge height size in pixels | No |
57+
| `badge_color` | `'#4492F9'` | Badge plot color (HEX or CSS color names) | No |
58+
| `badge_dark_color` | `'#4492F9'` | Badge plot dark color (HEX or CSS color names) | No |
59+
| `days_limit` | `15` | The amount of selected days | No |
60+
| `output_path` | `.pypi_chart/` | Badge file path directory | No |
61+
| `file_name` | `badge.svg` | Badge file name and extension (`.png`, `.jpg`, `.jpeg`, `.webp`, and `.pdf` are also supported) | No |
6162

6263
### License
6364
MIT license terms.

action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: PyPI package chart badge generator action
33
author: Sadra Yahyapour
44

55
branding:
6-
icon: 'activity'
7-
color: 'white'
6+
icon: "activity"
7+
color: "white"
88

99
runs:
1010
using: docker
@@ -35,7 +35,11 @@ inputs:
3535

3636
badge_color:
3737
description: The plot line color (HEX or CSS-valid names)
38-
default: '#4492F9'
38+
default: "#4492F9"
39+
40+
badge_dark_color:
41+
description: The plot line dark color (HEX or CSS-valid names)
42+
default: "#4492F9"
3943

4044
days_limit:
4145
description: The amount of selected days

main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def action(
3333
badge_width: int,
3434
badge_height: int,
3535
badge_color: str,
36+
badge_dark_color: str,
3637
days_limit: int,
3738
output_path: str,
3839
file_name: str,
@@ -41,6 +42,12 @@ def action(
4142
rates_df = package.get_rates(days_limit)
4243

4344
badge = Badge(rates_df).create(badge_height, badge_width, badge_color)
44-
path = Path(get_or_create_path(output_path)).joinpath(file_name)
45+
dark_badge = Badge(rates_df).create(badge_height, badge_width, badge_dark_color)
4546

46-
badge.write_image(path)
47+
badge_path = Path(get_or_create_path(output_path)).joinpath(file_name)
48+
dark_badge_path = Path(get_or_create_path(output_path)).joinpath(
49+
f"dark_{file_name}"
50+
)
51+
52+
badge.write_image(badge_path)
53+
dark_badge.write_image(dark_badge_path)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pypi-chart-badge"
3-
version = "1.3.0"
3+
version = "1.4.0"
44
description = "PyPI Chart Badge Generator"
55
readme = "README.md"
66
requires-python = ">=3.12"

0 commit comments

Comments
 (0)