Skip to content

Commit

Permalink
added dark mode feature which closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxpy committed Nov 28, 2024
1 parent 78b3057 commit d44594a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## PyPI Chart Badge
## 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/)

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

Expand Down Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/checkout@v4

- name: Updating the badge
uses: lnxpy/pypi-chart-badge@v1.3
uses: lnxpy/pypi-chart-badge@v1.4
with:
package_name: '<PACKAGE-NAME>'

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

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

### License
MIT license terms.
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: PyPI package chart badge generator action
author: Sadra Yahyapour

branding:
icon: 'activity'
color: 'white'
icon: "activity"
color: "white"

runs:
using: docker
Expand Down Expand Up @@ -35,7 +35,11 @@ inputs:

badge_color:
description: The plot line color (HEX or CSS-valid names)
default: '#4492F9'
default: "#4492F9"

badge_dark_color:
description: The plot line dark color (HEX or CSS-valid names)
default: "#4492F9"

days_limit:
description: The amount of selected days
Expand Down
11 changes: 9 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def action(
badge_width: int,
badge_height: int,
badge_color: str,
badge_dark_color: str,
days_limit: int,
output_path: str,
file_name: str,
Expand All @@ -41,6 +42,12 @@ def action(
rates_df = package.get_rates(days_limit)

badge = Badge(rates_df).create(badge_height, badge_width, badge_color)
path = Path(get_or_create_path(output_path)).joinpath(file_name)
dark_badge = Badge(rates_df).create(badge_height, badge_width, badge_dark_color)

badge.write_image(path)
badge_path = Path(get_or_create_path(output_path)).joinpath(file_name)
dark_badge_path = Path(get_or_create_path(output_path)).joinpath(
f"dark_{file_name}"
)

badge.write_image(badge_path)
dark_badge.write_image(dark_badge_path)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pypi-chart-badge"
version = "1.3.0"
version = "1.4.0"
description = "PyPI Chart Badge Generator"
readme = "README.md"
requires-python = ">=3.12"
Expand Down

0 comments on commit d44594a

Please sign in to comment.