# KSVGRestyle
KSVGRestyle is a command-line interface (CLI) tool designed to apply a color scheme to a specified SVG file of a Plasma desktop widget. This tool is ported from the [apply-stylesheet.sh](https://invent.kde.org/plasma/libplasma/-/blob/master/src/tools/apply-stylesheet.sh) script by the KDE Development Team.
## Features
- **Apply Color Schemes:** Modify the color palette of SVG files to match your desired Plasma desktop theme.
- **CLI Interface:** Easily integrate into scripts or use directly from the terminal.
<!-- Pytest Coverage Comment:Begin -->
<!-- Pytest Coverage Comment:End -->
## Installation
KSVGRestyle can be installed through several means. The most simple one (and recommended) would be installing it via [pipx](https://github.com/pypa/pipx)
```bash
# to install it from the PyPI registry
pipx install ksvg_restyle
# or
# to install directly from git
pipx install git+https://github.com/squalorware/KSVGRestyle.git
```
It will install the application to an isolated Python environment, and expose the entrypoint locally on one of the possible directories that are included to local `PATH` - usually `$HOME/.local/bin` or `$HOME/.bin` etc. Nevertheless, `pipx` provides an opportunity to install packages system-wide as well.
Users that do not utilize `pipx`, can install it like any other regular Python package using pip -
```bash
pip install --user ksvg_restyle
```
And of course, it is possible to build the installable Python package directly from the source code - in this case a user must ensure they have [Poetry](https://python-poetry.org/) installed (version 2 and higher) and run Python 3.12 or higher. To build the package, one should
1. **Clone the Repository:**
```bash
git clone https://github.com/squalorware/KSVGRestyle.git
```
2. **Navigate to the Project Directory:**
```bash
cd KSVGRestyle
```
3. **Install Runtime Dependencies:**
(Don't forget about [Poetry](https://python-poetry.org/)!)
```bash
poetry install --only main
```
4. **And finally**:
```bash
poetry build
```
If the build is successful, a directory named `dist` will appear in the root of the source code directory, which will contain Python package in both formats - wheel and sdist (a tar.gz archive)
## Usage
```bash
$ ksvgrestyle [OPTIONS] SVG
Options:
-c, --color-scheme PATH Path to the Plasma Color Theme file [required]
-o, --output PATH Output destination path (recolored SVG image)
-r, --replace Replace existing SVG. Effective only when no output
path provided.
--help Show this message and exit.
```
Since it is a Python package, it can also be called as a module
```bash
$ python -m ksvg_restyle [OPTIONS] SVG
```
## TODOs
- [ ] Add a possibility to pass a path to a directory containing the svg images to restyle them in-bulk
- [ ] Add an optional parameter for the user to decide whether to compress a resulting SVG image or not (right now the compression applies only if the input file was compressed as well).
## Contributing
Contributions are welcome! If you'd like to contribute to KSVGRestyle, please follow these steps:
1. **Fork the Repository:** Click on the "Fork" button at the top right corner of this page.
2. **Create a New Branch:** In your forked repository, create a new branch for your feature or bugfix.
3. **Make Your Changes:** Implement your feature or fix the bug.
4. **Submit a Pull Request:** Once your changes are ready, submit a pull request to the main repository.
## License
This project is licensed under the LGPL-2.1-or-later License. See the [LICENSE](LICENSE) file for more details.
## Acknowledgements
Special thanks to the KDE Development Team for the original [apply-stylesheet.sh](https://invent.kde.org/plasma/libplasma/-/blob/master/src/tools/apply-stylesheet.sh) script, which served as the foundation for this tool.
Raw data
{
"_id": null,
"home_page": "https://github.com/squalorware/KSVG_Restyle",
"name": "ksvg_restyle",
"maintainer": "oniko94",
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": "onikolaiev94@outlook.com",
"keywords": "cli, kde, svg, color, widget, theme, plasma",
"author": "oniko94",
"author_email": "onikolaiev94@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/ae/8b/e76e1080c76b02317d008a2990acd6269c5e0a2f4f4a319c3170a905dd2e/ksvg_restyle-0.1.5.tar.gz",
"platform": null,
"description": "# KSVGRestyle\n\nKSVGRestyle is a command-line interface (CLI) tool designed to apply a color scheme to a specified SVG file of a Plasma desktop widget. This tool is ported from the [apply-stylesheet.sh](https://invent.kde.org/plasma/libplasma/-/blob/master/src/tools/apply-stylesheet.sh) script by the KDE Development Team.\n\n## Features\n\n- **Apply Color Schemes:** Modify the color palette of SVG files to match your desired Plasma desktop theme.\n- **CLI Interface:** Easily integrate into scripts or use directly from the terminal.\n\n\n<!-- Pytest Coverage Comment:Begin -->\n<!-- Pytest Coverage Comment:End -->\n\n## Installation\n\nKSVGRestyle can be installed through several means. The most simple one (and recommended) would be installing it via [pipx](https://github.com/pypa/pipx)\n```bash\n# to install it from the PyPI registry\npipx install ksvg_restyle \n# or\n# to install directly from git\npipx install git+https://github.com/squalorware/KSVGRestyle.git \n```\nIt will install the application to an isolated Python environment, and expose the entrypoint locally on one of the possible directories that are included to local `PATH` - usually `$HOME/.local/bin` or `$HOME/.bin` etc. Nevertheless, `pipx` provides an opportunity to install packages system-wide as well.\n\nUsers that do not utilize `pipx`, can install it like any other regular Python package using pip -\n```bash\npip install --user ksvg_restyle\n```\n\nAnd of course, it is possible to build the installable Python package directly from the source code - in this case a user must ensure they have [Poetry](https://python-poetry.org/) installed (version 2 and higher) and run Python 3.12 or higher. To build the package, one should\n\n1. **Clone the Repository:**\n\n ```bash\n git clone https://github.com/squalorware/KSVGRestyle.git\n ```\n\n2. **Navigate to the Project Directory:**\n\n ```bash\n cd KSVGRestyle\n ```\n\n3. **Install Runtime Dependencies:**\n\n (Don't forget about [Poetry](https://python-poetry.org/)!)\n\n ```bash\n poetry install --only main \n ```\n4. **And finally**:\n\n ```bash\n poetry build \n ```\nIf the build is successful, a directory named `dist` will appear in the root of the source code directory, which will contain Python package in both formats - wheel and sdist (a tar.gz archive)\n\n## Usage\n```bash\n $ ksvgrestyle [OPTIONS] SVG\n\nOptions:\n -c, --color-scheme PATH Path to the Plasma Color Theme file [required]\n -o, --output PATH Output destination path (recolored SVG image)\n -r, --replace Replace existing SVG. Effective only when no output\n path provided.\n --help Show this message and exit.\n```\nSince it is a Python package, it can also be called as a module \n```bash\n$ python -m ksvg_restyle [OPTIONS] SVG\n```\n\n## TODOs\n\n- [ ] Add a possibility to pass a path to a directory containing the svg images to restyle them in-bulk\n- [ ] Add an optional parameter for the user to decide whether to compress a resulting SVG image or not (right now the compression applies only if the input file was compressed as well).\n\n## Contributing\n\nContributions are welcome! If you'd like to contribute to KSVGRestyle, please follow these steps:\n\n1. **Fork the Repository:** Click on the \"Fork\" button at the top right corner of this page.\n2. **Create a New Branch:** In your forked repository, create a new branch for your feature or bugfix.\n3. **Make Your Changes:** Implement your feature or fix the bug.\n4. **Submit a Pull Request:** Once your changes are ready, submit a pull request to the main repository.\n\n## License\n\nThis project is licensed under the LGPL-2.1-or-later License. See the [LICENSE](LICENSE) file for more details.\n\n## Acknowledgements\n\nSpecial thanks to the KDE Development Team for the original [apply-stylesheet.sh](https://invent.kde.org/plasma/libplasma/-/blob/master/src/tools/apply-stylesheet.sh) script, which served as the foundation for this tool.\n",
"bugtrack_url": null,
"license": "LGPL-2.1-or-later",
"summary": "A CLI tool to apply Plasma Color Schemes to SVG widgets",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/squalorware/KSVG_Restyle",
"Repository": "https://github.com/squalorware/KSVG_Restyle"
},
"split_keywords": [
"cli",
" kde",
" svg",
" color",
" widget",
" theme",
" plasma"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "56d6a385c59278f6f474a4bc1bfa61916ee2290e174ea8f54364d17e453877e1",
"md5": "422a1ca0f767b30e9a60ce2f6d92c6fe",
"sha256": "158bde32cb1f3222893ecf60a95f387cd6e81c3fa8e42072506eb145324b8c99"
},
"downloads": -1,
"filename": "ksvg_restyle-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "422a1ca0f767b30e9a60ce2f6d92c6fe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 13623,
"upload_time": "2025-03-09T13:26:41",
"upload_time_iso_8601": "2025-03-09T13:26:41.632105Z",
"url": "https://files.pythonhosted.org/packages/56/d6/a385c59278f6f474a4bc1bfa61916ee2290e174ea8f54364d17e453877e1/ksvg_restyle-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae8be76e1080c76b02317d008a2990acd6269c5e0a2f4f4a319c3170a905dd2e",
"md5": "0b15c5e3734226a60c04ad2d10148129",
"sha256": "a4c0e3695f6b0c7f57156c9c7520f299f8f8d544cdcd46e8e1a562bd576cbc32"
},
"downloads": -1,
"filename": "ksvg_restyle-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "0b15c5e3734226a60c04ad2d10148129",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 11088,
"upload_time": "2025-03-09T13:26:42",
"upload_time_iso_8601": "2025-03-09T13:26:42.664664Z",
"url": "https://files.pythonhosted.org/packages/ae/8b/e76e1080c76b02317d008a2990acd6269c5e0a2f4f4a319c3170a905dd2e/ksvg_restyle-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-09 13:26:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "squalorware",
"github_project": "KSVG_Restyle",
"github_not_found": true,
"lcname": "ksvg_restyle"
}