Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit ad1041d

Browse files
authored
Merge pull request #19 from DirectiveAthena/v5.1.1_Proposal
v5.1.1 Proposal
2 parents 9f49ad1 + ca6f4a2 commit ad1041d

File tree

7 files changed

+108
-191
lines changed

7 files changed

+108
-191
lines changed

Examples/Styling.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# - AthenaColor -
22
[![pypi](https://img.shields.io/pypi/v/AthenaColor)](https://pypi.org/project/AthenaColor/) [![GitHub license](https://img.shields.io/github/license/DirectiveAthena/VerSC-AthenaColor)](https://github.com/DirectiveAthena/VerSC-AthenaColor/blob/master/LICENSE) [![Discord](https://img.shields.io/discord/814599159926620160?color=maroon)](https://discord.gg/6JcDbhXkCH) [![Downloads](https://pepy.tech/badge/athenacolor)](https://pepy.tech/project/athenacolor)
33

4-
<img height="128" src="https://github.com/DirectiveAthena/VSC-AthenaColor/blob/master/Resources/AthenaColor.png?raw=true" width="128"/>
4+
<img height="128" src="https://github.com/DirectiveAthena/AthenaColor/blob/master/Resources/AthenaColor.png?raw=true" width="128" alt="AthenaColor Logo"/>
55

66
---
77
## Package Details
@@ -16,11 +16,11 @@ A *No Dependency* Python package do display stext styling in a console.
1616
#### Python Version
1717
- Supported Python versions: **3.7**, **3.8**, **3.9**, **3.10**
1818
- Other older versions of Python are not currently supported.
19-
- These older versions will probably not be supported by @Andreas Sas himself, but if you want to contribute to the project and make this package compatible with older versions of Python, Pull requests are always welcome.
19+
- These older versions will probably not be supported by @AndreasSas himself, but if you want to contribute to the project and make this package compatible with older versions of Python, Pull requests are always welcome.
2020

2121
---
2222
## Quick Examples
23-
Inline styling:
23+
**Inline styling**:
2424
```python
2525
from AthenaColor import Fore, Style
2626

@@ -32,7 +32,7 @@ print(
3232
"""
3333
)
3434
```
35-
Nested Styling:
35+
**Nested Styling**:
3636
```python
3737
from AthenaColor import ForeNest, StyleNest
3838

@@ -44,7 +44,7 @@ print(
4444
StyleNest.Bold("EXAMPLE"),
4545
"of nested styling"
4646
),
47-
"As you can see, the correct color returns here by itself",
47+
"As you can see, a reset of color doesn't need to happen as this is done automatically",
4848
sep="\n"
4949
))
5050
)
@@ -54,20 +54,21 @@ print(
5454
## Documentation
5555
Full documentation can be found at:
5656
**[directiveathena.com/athenacolor-docu](https://www.directiveathena.com/athenacolor-docu)** (redirect to Obsidian.md publish site)
57+
(Reminder, the documentation is still under heavy development)
5758

5859
---
5960
## Install
6061
To install the package in your Python environment
6162

62-
```console
63+
```
6364
pip install AthenaColor --upgrade
6465
```
6566

6667
---
6768

6869
## Links
6970
Project files can be found at:
70-
- [GitHub Repo](https://github.com/DirectiveAthena/VerSC-AthenaColor)
71+
- [GitHub Repo](https://github.com/DirectiveAthena/AthenaColor)
7172
- [Pypi link](https://pypi.org/project/AthenaColor/)
7273

7374
---

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
setuptools.setup(
1616
name="AthenaColor",
17-
version="5.1.0",
17+
version="5.1.1",
1818
author="Andreas Sas",
1919
author_email="",
2020
description="Package to support full usage of RGB colors in the Console.",
2121
long_description=long_description,
2222
long_description_content_type="text/markdown",
23-
url="https://github.com/DirectiveAthena/VerSC-AthenaColor",
23+
url="https://github.com/DirectiveAthena/AthenaColor",
2424
project_urls={
25-
"Bug Tracker": "https://github.com/DirectiveAthena/VerSC-AthenaColor/issues",
25+
"Bug Tracker": "https://github.com/DirectiveAthena/AthenaColor/issues",
2626
},
2727
license="GPLv3",
2828
package_dir={"": "src"},

src/AthenaColor/Color/ColorSystem.py

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -568,95 +568,72 @@ def __repr__(self) -> str:
568568
# BELOW HERE IS FOR SPEED INCREASE!
569569
# Possible because we now have a __hash__ on any given ColorSystem class
570570
# needs to be placed here, as only after all the defining of all the colors, this map can be made
571-
_r_export = lambda r: r.export()
572-
_r_export_RGBAtoRGB = lambda r: (r.r, r.g, r.b)
573-
_tuple3 = lambda r: (r,r,r)
574-
_tuple4 = lambda r: (r,r,r,r)
575-
_same = lambda r: r
576-
trnspDef = init.transparentDefault[1]
571+
_rgb_hex_mapped = {
572+
RGB: lambda r: r.export(),
573+
HEX: lambda r: r.export(),
574+
HSL: lambda r: hsl_to_rgb(r.h, r.s, r.l),
575+
HSV: lambda r: hsv_to_rgb(r.h, r.s, r.v),
576+
CMYK: lambda r: cmyk_to_rgb(r.c,r.m,r.y,r.k),
577+
RGBA: lambda r: (r.r, r.g, r.b),
578+
HEXA: lambda r: (r.r, r.g, r.b),
579+
int: lambda r: (r,r,r),
580+
float: lambda r: (r,r,r),
581+
tuple: lambda r: r
582+
}
583+
_rgba_hexa_mapped = {
584+
RGB: lambda r: (r.r, r.g, r.b, init.transparentDefault[1]),
585+
HEX: lambda r: (r.r, r.g, r.b, init.transparentDefault[1]),
586+
HSL: lambda r: (*hsl_to_rgb(r.h, r.s, r.l), init.transparentDefault[1]),
587+
HSV: lambda r: (*hsv_to_rgb(r.h, r.s, r.v), init.transparentDefault[1]),
588+
CMYK: lambda r: (*cmyk_to_rgb(r.c,r.m,r.y,r.k), init.transparentDefault[1]),
589+
RGBA: lambda r: r.export(),
590+
HEXA: lambda r: r.export(),
591+
int: lambda r: (r,r,r,r),
592+
float: lambda r: (r,r,r,r),
593+
tuple: lambda r: r
594+
}
595+
577596
color_conversions_mapped ={
578-
RGB : {
579-
RGB: _r_export,
580-
HEX: _r_export,
581-
HSL: lambda r: hsl_to_rgb(r.h, r.s, r.l),
582-
HSV: lambda r: hsv_to_rgb(r.h, r.s, r.v),
583-
CMYK: lambda r: cmyk_to_rgb(r.c,r.m,r.y,r.k),
584-
RGBA: _r_export_RGBAtoRGB,
585-
HEXA: _r_export_RGBAtoRGB,
586-
int: _tuple3,
587-
float: _tuple3,
588-
tuple: _same
589-
},
590-
HEX : {
591-
RGB: _r_export,
592-
HEX: _r_export,
593-
HSL: lambda r: hsl_to_rgb(r.h, r.s, r.l),
594-
HSV: lambda r: hsv_to_rgb(r.h, r.s, r.v),
595-
CMYK: lambda r: cmyk_to_rgb(r.c,r.m,r.y,r.k),
596-
RGBA: _r_export_RGBAtoRGB,
597-
HEXA: _r_export_RGBAtoRGB,
598-
int: _tuple3,
599-
float: _tuple3,
600-
tuple: _same
601-
},
597+
# RGB, HEX follow the same pattern
598+
RGB : _rgb_hex_mapped,
599+
HEX : _rgb_hex_mapped,
600+
# RGBA and HEXA follow the same pattern
601+
RGBA : _rgba_hexa_mapped,
602+
HEXA : _rgba_hexa_mapped,
602603
HSL : {
603604
RGB: lambda r: rgb_to_hsl(r.r, r.g, r.b),
604605
HEX: lambda r: rgb_to_hsl(r.r, r.g, r.b),
605-
HSL: _r_export,
606+
HSL: lambda r: r.export(),
606607
HSV: lambda r: hsv_to_hsl(r.h, r.s, r.v),
607608
CMYK: lambda r: cmyk_to_hsl(r.c,r.m,r.y,r.k),
608609
RGBA: lambda r: rgb_to_hsl(r.r, r.g, r.b),
609610
HEXA: lambda r: rgb_to_hsl(r.r, r.g, r.b),
610-
int: _tuple3,
611-
float: _tuple3,
612-
tuple: _same
611+
int: lambda r: (r,r,r),
612+
float: lambda r: (r,r,r),
613+
tuple: lambda r: r
613614
},
614615
HSV : {
615616
RGB: lambda r: rgb_to_hsv(r.r, r.g, r.b),
616617
HEX: lambda r: rgb_to_hsv(r.r, r.g, r.b),
617618
HSL: lambda r: hsl_to_hsv(r.h, r.s, r.l),
618-
HSV: _r_export,
619+
HSV: lambda r: r.export(),
619620
CMYK: lambda r: cmyk_to_hsv(r.c,r.m,r.y,r.k),
620621
RGBA: lambda r: rgb_to_hsv(r.r, r.g, r.b),
621622
HEXA: lambda r: rgb_to_hsv(r.r, r.g, r.b),
622-
int: _tuple3,
623-
float: _tuple3,
624-
tuple: _same
623+
int: lambda r: (r,r,r),
624+
float: lambda r: (r,r,r),
625+
tuple: lambda r: r
625626
},
626627
CMYK : {
627628
RGB: lambda r: rgb_to_cmyk(r.r, r.g, r.b),
628629
HEX: lambda r: rgb_to_cmyk(r.r, r.g, r.b),
629630
HSL: lambda r: hsl_to_cmyk(r.h, r.s, r.l),
630631
HSV: lambda r: hsv_to_cmyk(r.h, r.s, r.v),
631-
CMYK: _r_export,
632+
CMYK: lambda r: r.export(),
632633
RGBA: lambda r: rgb_to_cmyk(r.r, r.g, r.b),
633634
HEXA: lambda r: rgb_to_cmyk(r.r, r.g, r.b),
634-
int: _tuple4,
635-
float: _tuple4,
636-
tuple: _same
637-
},
638-
RGBA : {
639-
RGB: lambda r: (r.r, r.g, r.b, trnspDef),
640-
HEX: lambda r: (r.r, r.g, r.b, trnspDef),
641-
HSL: lambda r: (*hsl_to_rgb(r.h, r.s, r.l), trnspDef),
642-
HSV: lambda r: (*hsv_to_rgb(r.h, r.s, r.v), trnspDef),
643-
CMYK: lambda r: (*cmyk_to_rgb(r.c,r.m,r.y,r.k), trnspDef),
644-
RGBA: _r_export,
645-
HEXA: _r_export,
646-
int: _tuple4,
647-
float: _tuple4,
648-
tuple: _same
649-
},
650-
HEXA : {
651-
RGB: lambda r: (r.r, r.g, r.b, trnspDef),
652-
HEX: lambda r: (r.r, r.g, r.b, trnspDef),
653-
HSL: lambda r: (*hsl_to_rgb(r.h, r.s, r.l), trnspDef),
654-
HSV: lambda r: (*hsv_to_rgb(r.h, r.s, r.v), trnspDef),
655-
CMYK: lambda r: (*cmyk_to_rgb(r.c,r.m,r.y,r.k), trnspDef),
656-
RGBA: _r_export,
657-
HEXA: _r_export,
658-
int: _tuple4,
659-
float: _tuple4,
660-
tuple: _same
661-
},
635+
int: lambda r: (r,r,r,r),
636+
float: lambda r: (r,r,r,r),
637+
tuple: lambda r: r
638+
}
662639
}

0 commit comments

Comments
 (0)