https://github.com/blueamethyst-studios/css.py
A library for writing CSS code and then compiling it into default CSS.
https://github.com/blueamethyst-studios/css.py
css library package python
Last synced: 2 months ago
JSON representation
A library for writing CSS code and then compiling it into default CSS.
- Host: GitHub
- URL: https://github.com/blueamethyst-studios/css.py
- Owner: BLUEAMETHYST-Studios
- License: gpl-3.0
- Created: 2023-06-29T19:33:48.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-30T20:09:14.000Z (about 3 years ago)
- Last Synced: 2025-09-27T14:13:46.340Z (10 months ago)
- Topics: css, library, package, python
- Language: Python
- Homepage: https://blueamethyst.me/CSS.py/
- Size: 85.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# CSS.py
A simple way of making CSS code in Python.
## Your CSS.py installation
### Installing CSS.py
```
pip install cssdotpy
```
### Updating CSS.py
```
pip install --upgrade cssdotpy
```
## Links
- [CODE OF CONDUCT](https://github.com/BLUEAMETHYST-Studios/CSS.py/blob/main/CODE_OF_CONDUCT.md)
- [CONTRIBUTORS](https://github.com/BLUEAMETHYST-Studios/CSS.py/blob/main/CONTRIBUTORS.md)
- [CONTRIBUTING POLICY](https://github.com/BLUEAMETHYST-Studios/CSS.py/blob/main/CONTRIBUTING.md)
- [SECURITY POLICY](https://github.com/BLUEAMETHYST-Studios/CSS.py/blob/main/SECURITY.md)
## Using it
### NOTICE: CSS.PY IS IN ALPHA DEVELOPMENT STAGES AND DOES NOT HAVE MANY FEATURES YET
### Creating a CSS instance
```py
import cssdotpy
MyCSS = cssdotpy.CSS()
```
### Adding HTML elements to the CSS and styling them
```py
import cssdotpy
MyCSS = cssdotpy.CSS()
MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])
```
### Adding HTML classes to the CSS and styling them
```py
import cssdotpy
MyCSS = cssdotpy.CSS()
MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])
```
### Adding Events to elements and/or classes and styling those
```py
import cssdotpy
MyCSS = cssdotpy.CSS()
MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])
MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])
MyCSS.addEventToElement(element="p", event="hover", style=["color:blue", "transform: scale(1.1)"])
MyCSS.addEventToClass(name="MyClassName", event="hover", style=["color:blue", "transform: scale(1.1)"])
```
### Getting your CSS
```py
import cssdotpy
MyCSS = cssdotpy.CSS()
MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])
MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])
MyCSS.addEventToElement(element="p", event="hover", style=["color:blue", "transform: scale(1.1)"])
MyCSS.addEventToClass(name="MyClassName", event="hover", style=["color:blue", "transform: scale(1.1)"])
# Print CSS
print(MyCSS.returnCSS())
# Output to file
open("output.css", "w").write(MyCSS.returnCSS())
```