diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 12:15:08 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 12:15:08 +0000 |
| commit | ac2546e52fbacd5b0c699b3a635326da2bee2d86 (patch) | |
| tree | 514515ecc9ca1ed6842d1f00ac9426479ac29d4f /python-colouration.spec | |
| parent | 0272e381f1fb155b9d4292f2093e5f57798946de (diff) | |
automatic import of python-colourationopeneuler20.03
Diffstat (limited to 'python-colouration.spec')
| -rw-r--r-- | python-colouration.spec | 345 |
1 files changed, 345 insertions, 0 deletions
diff --git a/python-colouration.spec b/python-colouration.spec new file mode 100644 index 0000000..a535eb9 --- /dev/null +++ b/python-colouration.spec @@ -0,0 +1,345 @@ +%global _empty_manifest_terminate_build 0 +Name: python-colouration +Version: 2020.7.26 +Release: 1 +Summary: Python library for working with colours +License: MIT +URL: https://github.com/idin/colouration +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/38/89/999ced63975b9ea7e0c4fe27ef9f4b682a9702f7f930f28eb219c3ae4ba8/colouration-2020.7.26.tar.gz +BuildArch: noarch + + +%description +# *Colouration* + +*Colouration* is a Python library for working with colours. +It unifies three representation of colour: +- [RGB](https://en.wikipedia.org/wiki/RGB_color_model) (red, green, blue) +- [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness) +- [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, value) + +## Installation +```bash +pip install colouration +``` + +## Usage + +### `Colour` +```python +from colouration import Colour + +default_arguments = Colour( + obj=None, + red=None, green=None, blue=None, + hexadecimal=None, + hue=None, saturation=None, lightness=None, value=None, + min_value=0.0, max_value=1.0, + name=None, id=None, scheme=None, + weight=1.0 +) + +# you can use the rgb hexadecimal code to create a Colour object +red = Colour('#FF0000') + +# you can enter red, green, and blue as separate values +green = Colour(red=0, green=1, blue=0) + +# max value is 1 by default but other values can be used too +blue = Colour(red=0, green=0, blue=255, max_value=255) + +# and you can use colour names +literal_red = Colour('red') +print(f'is red equal to literal_red? {"yes" if red == literal_red else "no"}\n') + +# you can print with it +literal_red.print('by default the main colour is used for background\n') + +# to use the colour as the text colour you should use the main_colour argument +red.print(string='red text\n', main_colour='text', secondary='auto') # secondary='auto' is default + +# the secondary colour is white when the main colour is dark and it is black otherwise +red.print(string='the secondary colour is white when the main colour is dark and it is black otherwise.\n') + +# you can choose a secondary colour +red.print(string='red on white\n', main_colour='text', secondary='white') + +# you can use string or a Colour object +red.print(string='blue on red\n', secondary=Colour('blue')) + +# you can darken or lighten a colour +dark_red = red.darken(ratio=0.5) +dark_red.print(string='dark red\n') + +# ratio can be between 0 and 1 +light_red = red.lighten(ratio=0.8) + +# you can change the hue of a colour +new_colour = red.increase_hue(0.2) +new_colour.print('hue increased by 0.2\n') + +# you can assign a new hue, lightness, value, red, green, or blue too +new_colour.red = 0.2 +new_colour.print('setting red = 0.2 causes this.\n') +new_colour.hue = 0.8 +new_colour.print('setting hue = 0.4 causes this.\n') +new_colour.value = 0.3 +new_colour.print('setting value = 0.3 causes this.\n') +new_colour.lightness = 0.9 +new_colour.print('setting lightness = 0.9 causes this.\n') + +# you can mix colours by adding them together +yellow = green + red +yellow.print(string='mixing green and red produces this.\n') + +# Colour finds the best name for itself +bluish = Colour(red=220, green=243, blue=255, max_value=255) # max_value is 1 by default +bluish.print(string=f'Colour finds the best name for itself: {bluish.name}.\n') +``` + +### `Scheme` + +### `Gradient` + + + +%package -n python3-colouration +Summary: Python library for working with colours +Provides: python-colouration +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-colouration +# *Colouration* + +*Colouration* is a Python library for working with colours. +It unifies three representation of colour: +- [RGB](https://en.wikipedia.org/wiki/RGB_color_model) (red, green, blue) +- [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness) +- [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, value) + +## Installation +```bash +pip install colouration +``` + +## Usage + +### `Colour` +```python +from colouration import Colour + +default_arguments = Colour( + obj=None, + red=None, green=None, blue=None, + hexadecimal=None, + hue=None, saturation=None, lightness=None, value=None, + min_value=0.0, max_value=1.0, + name=None, id=None, scheme=None, + weight=1.0 +) + +# you can use the rgb hexadecimal code to create a Colour object +red = Colour('#FF0000') + +# you can enter red, green, and blue as separate values +green = Colour(red=0, green=1, blue=0) + +# max value is 1 by default but other values can be used too +blue = Colour(red=0, green=0, blue=255, max_value=255) + +# and you can use colour names +literal_red = Colour('red') +print(f'is red equal to literal_red? {"yes" if red == literal_red else "no"}\n') + +# you can print with it +literal_red.print('by default the main colour is used for background\n') + +# to use the colour as the text colour you should use the main_colour argument +red.print(string='red text\n', main_colour='text', secondary='auto') # secondary='auto' is default + +# the secondary colour is white when the main colour is dark and it is black otherwise +red.print(string='the secondary colour is white when the main colour is dark and it is black otherwise.\n') + +# you can choose a secondary colour +red.print(string='red on white\n', main_colour='text', secondary='white') + +# you can use string or a Colour object +red.print(string='blue on red\n', secondary=Colour('blue')) + +# you can darken or lighten a colour +dark_red = red.darken(ratio=0.5) +dark_red.print(string='dark red\n') + +# ratio can be between 0 and 1 +light_red = red.lighten(ratio=0.8) + +# you can change the hue of a colour +new_colour = red.increase_hue(0.2) +new_colour.print('hue increased by 0.2\n') + +# you can assign a new hue, lightness, value, red, green, or blue too +new_colour.red = 0.2 +new_colour.print('setting red = 0.2 causes this.\n') +new_colour.hue = 0.8 +new_colour.print('setting hue = 0.4 causes this.\n') +new_colour.value = 0.3 +new_colour.print('setting value = 0.3 causes this.\n') +new_colour.lightness = 0.9 +new_colour.print('setting lightness = 0.9 causes this.\n') + +# you can mix colours by adding them together +yellow = green + red +yellow.print(string='mixing green and red produces this.\n') + +# Colour finds the best name for itself +bluish = Colour(red=220, green=243, blue=255, max_value=255) # max_value is 1 by default +bluish.print(string=f'Colour finds the best name for itself: {bluish.name}.\n') +``` + +### `Scheme` + +### `Gradient` + + + +%package help +Summary: Development documents and examples for colouration +Provides: python3-colouration-doc +%description help +# *Colouration* + +*Colouration* is a Python library for working with colours. +It unifies three representation of colour: +- [RGB](https://en.wikipedia.org/wiki/RGB_color_model) (red, green, blue) +- [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness) +- [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, value) + +## Installation +```bash +pip install colouration +``` + +## Usage + +### `Colour` +```python +from colouration import Colour + +default_arguments = Colour( + obj=None, + red=None, green=None, blue=None, + hexadecimal=None, + hue=None, saturation=None, lightness=None, value=None, + min_value=0.0, max_value=1.0, + name=None, id=None, scheme=None, + weight=1.0 +) + +# you can use the rgb hexadecimal code to create a Colour object +red = Colour('#FF0000') + +# you can enter red, green, and blue as separate values +green = Colour(red=0, green=1, blue=0) + +# max value is 1 by default but other values can be used too +blue = Colour(red=0, green=0, blue=255, max_value=255) + +# and you can use colour names +literal_red = Colour('red') +print(f'is red equal to literal_red? {"yes" if red == literal_red else "no"}\n') + +# you can print with it +literal_red.print('by default the main colour is used for background\n') + +# to use the colour as the text colour you should use the main_colour argument +red.print(string='red text\n', main_colour='text', secondary='auto') # secondary='auto' is default + +# the secondary colour is white when the main colour is dark and it is black otherwise +red.print(string='the secondary colour is white when the main colour is dark and it is black otherwise.\n') + +# you can choose a secondary colour +red.print(string='red on white\n', main_colour='text', secondary='white') + +# you can use string or a Colour object +red.print(string='blue on red\n', secondary=Colour('blue')) + +# you can darken or lighten a colour +dark_red = red.darken(ratio=0.5) +dark_red.print(string='dark red\n') + +# ratio can be between 0 and 1 +light_red = red.lighten(ratio=0.8) + +# you can change the hue of a colour +new_colour = red.increase_hue(0.2) +new_colour.print('hue increased by 0.2\n') + +# you can assign a new hue, lightness, value, red, green, or blue too +new_colour.red = 0.2 +new_colour.print('setting red = 0.2 causes this.\n') +new_colour.hue = 0.8 +new_colour.print('setting hue = 0.4 causes this.\n') +new_colour.value = 0.3 +new_colour.print('setting value = 0.3 causes this.\n') +new_colour.lightness = 0.9 +new_colour.print('setting lightness = 0.9 causes this.\n') + +# you can mix colours by adding them together +yellow = green + red +yellow.print(string='mixing green and red produces this.\n') + +# Colour finds the best name for itself +bluish = Colour(red=220, green=243, blue=255, max_value=255) # max_value is 1 by default +bluish.print(string=f'Colour finds the best name for itself: {bluish.name}.\n') +``` + +### `Scheme` + +### `Gradient` + + + +%prep +%autosetup -n colouration-2020.7.26 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-colouration -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2020.7.26-1 +- Package Spec generated |
