Commit e88db93
feat: add SVG progress bar support with color and shape options (#657)
* feat: add SVG progress bar support with color and shape options
## What changed
Added SVG-based progress bar rendering as an alternative to the existing Unicode text bars. Controlled entirely via workflow inputs — no code changes needed after this commit.
### New workflow inputs
| Input | Default | Description |
|---|---|---|
| `BAR_STYLE` | `"text"` | `"text"` for original Unicode bars, `"svg"` for colored SVG bars |
| `BAR_COLOR` | `"#90CAF9"` | Fill color of the progress bar |
| `BAR_TRACK_COLOR` | `"#172f45"` | Background track color of the bar |
| `BAR_RADIUS` | `"0"` | `"0"` for square edges, `"4"` for subtle rounded edges |
### Files changed
- `sources/manager_environment.py` — added `BAR_STYLE`, `BAR_COLOR`, `BAR_TRACK_COLOR`, `BAR_RADIUS` env vars
- `sources/graphics_list_formatter.py` — updated `make_graph()` to branch between text and SVG output
---
## Usage
```yaml
- uses: acheronx0577/waka-readme-stats@master
with:
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BAR_STYLE: "svg"
BAR_COLOR: "#90CAF9"
BAR_TRACK_COLOR: "#172f45"
BAR_RADIUS: "0"
```
> Swap `BAR_RADIUS` between `"0"` (square) and `"4"` (subtle round). Any hex color works for `BAR_COLOR` and `BAR_TRACK_COLOR`.
* docs: update README files to include SVG progress bar options
Added detailed documentation for SVG progress bars across multiple language versions of the README. Included new flags for customization: `BAR_STYLE`, `BAR_COLOR`, `BAR_TRACK_COLOR`, and `BAR_RADIUS`, along with example workflow configurations.
Files updated:
- `README.md`
- `locales/README.de.md`
- `locales/README.es.md`
- `locales/README.fr.md`
- `locales/README.hi.md`
- `locales/README.ja.md`
- `locales/README.ko.md`
- `locales/README.pt.md`
- `locales/README.ru.md`
- `locales/README.zh.md`
* fix: remove unnecessary whitespace in make_graph function
* docs: enhance README files with before/after examples for SVG progress bars
Added detailed before/after examples for default Unicode and SVG progress bars in multiple language versions of the README. This update improves clarity on the visual differences and usage of the new `BAR_STYLE` option.
Files updated:
- `README.md`
- `locales/README.de.md`
- `locales/README.es.md`
- `locales/README.fr.md`
- `locales/README.hi.md`
- `locales/README.ja.md`
- `locales/README.ko.md`
- `locales/README.pt.md`
- `locales/README.ru.md`
- `locales/README.zh.md`
* docs: update README files to clarify SVG progress bar options with square and rounded corner examples
Enhanced documentation across multiple language versions of the README to include visual examples of SVG progress bars with square and rounded corners. This update improves user understanding of the `BAR_RADIUS` option.
Files updated:
- `README.md`
- `locales/README.de.md`
- `locales/README.es.md`
- `locales/README.fr.md`
- `locales/README.hi.md`
- `locales/README.ja.md`
- `locales/README.ko.md`
- `locales/README.pt.md`
- `locales/README.ru.md`
- `locales/README.zh.md`
* remove: delete test demo workflow file
* fix: use getenv() consistently in manager_environment.py
* feat: implement EnvironmentManager class to handle and parse action configuration variables
* feat: add options to `action.yml`
* feat: enhance make_list function to support SVG rendering for progress bars
Updated the make_list function to conditionally render progress bars in SVG format based on the BAR_STYLE setting. Added support for SVG attributes and improved text handling for names and times. Adjusted related functions to ensure consistent output format for both SVG and text modes.
* refactor: streamline SVG rendering in make_list function
Consolidated SVG element construction in the make_list function for improved readability and maintainability. Removed unnecessary whitespace and simplified string concatenation for SVG output. Minor adjustments made to ensure consistent formatting across SVG and text modes.
* feat: add text color options to action.yml and update environment variable handling
Introduced new optional inputs for primary and secondary text colors in action.yml. Updated the EnvironmentManager class to support these new inputs, allowing for more customizable SVG rendering. Adjusted environment variable retrieval to ensure consistent handling of input values.
* Update sources/graphics_list_formatter.py
Co-authored-by: okcoder1 <codershub.code@gmail.com>
* Update sources/main.py
Co-authored-by: okcoder1 <codershub.code@gmail.com>
* remove: delete Waka Readme workflow file and simplify progress bar rendering in graphics_list_formatter.py
The Waka Readme workflow file has been removed. Additionally, the make_graph function in graphics_list_formatter.py has been updated to focus solely on text progress bar rendering, eliminating the SVG rendering logic for improved clarity and maintainability.
* Update sources/graphics_list_formatter.py
Co-authored-by: okcoder1 <codershub.code@gmail.com>
* Update sources/graphics_list_formatter.py
Co-authored-by: okcoder1 <codershub.code@gmail.com>
* docs: add TEXT_PRIMARY_COLOR and TEXT_SECONDARY_COLOR options to README files
Updated README files across multiple languages to include new environment variables for customizing primary and secondary text colors in SVG progress bars. Acknowledged contributions from AcheronX for adding SVG progress bar support with color and shape options.
* chore: add fields in .env.example
---------
Co-authored-by: okcoder1 <codershub.code@gmail.com>
Co-authored-by: Anshuman Singh <anshumanr22@outlook.com>1 parent 18146e8 commit e88db93
15 files changed
Lines changed: 643 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
329 | 380 | | |
330 | 381 | | |
331 | 382 | | |
| |||
375 | 426 | | |
376 | 427 | | |
377 | 428 | | |
| 429 | + | |
378 | 430 | | |
379 | 431 | | |
380 | 432 | | |
| |||
520 | 572 | | |
521 | 573 | | |
522 | 574 | | |
| 575 | + | |
| 576 | + | |
523 | 577 | | |
524 | 578 | | |
525 | 579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
180 | 210 | | |
181 | 211 | | |
182 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
279 | 330 | | |
280 | 331 | | |
281 | 332 | | |
| |||
313 | 364 | | |
314 | 365 | | |
315 | 366 | | |
| 367 | + | |
316 | 368 | | |
317 | 369 | | |
318 | 370 | | |
| |||
458 | 510 | | |
459 | 511 | | |
460 | 512 | | |
| 513 | + | |
| 514 | + | |
461 | 515 | | |
462 | 516 | | |
463 | 517 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
278 | 329 | | |
279 | 330 | | |
280 | 331 | | |
| |||
312 | 363 | | |
313 | 364 | | |
314 | 365 | | |
| 366 | + | |
315 | 367 | | |
316 | 368 | | |
317 | 369 | | |
| |||
457 | 509 | | |
458 | 510 | | |
459 | 511 | | |
| 512 | + | |
| 513 | + | |
460 | 514 | | |
461 | 515 | | |
462 | 516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
278 | 329 | | |
279 | 330 | | |
280 | 331 | | |
| |||
312 | 363 | | |
313 | 364 | | |
314 | 365 | | |
| 366 | + | |
315 | 367 | | |
316 | 368 | | |
317 | 369 | | |
| |||
457 | 509 | | |
458 | 510 | | |
459 | 511 | | |
| 512 | + | |
| 513 | + | |
460 | 514 | | |
461 | 515 | | |
462 | 516 | | |
| |||
0 commit comments