Skip to main content

Colorful Terminal Prints

Project description

Chromify - Python Library Documentation

Chromify is a Python library that provides functionalities for color manipulation and conversion. It allows you to convert between different color representations such as RGB, HEX, HSL, CMYK, and HSV, and perform various color operations.

BANNER

GitHub all releases Static Badge GitHub release (with filter) GitHub Repo stars

Table of Contents

Installation

You can install Chromify using pip: pip install chromify

Usage

Color Class

The Color class represents a color and provides methods for color conversion and manipulation.

Creating a Color Object

You can create a Color object in the following ways:

from chromify import Color

# Create a Color object from a CSS representation
color1 = Color("#FF0000")
color2 = Color("rgb(255, 0, 0)")
color3 = Color("hsl(0, 100%, 50%)")

# Create a Color object from RGB values
color4 = Color(255, 0, 0)

# Create a Color object from another Color object
color5 = Color(color1)

Color Conversion

You can convert a Color object to different representations using the following methods:

# Convert to HEX representation
hex_value = color1.to_hex()  # Returns "#FF0000"

# Convert to HSL representation
hsl_value = color1.to_hsl()  # Returns "hsl(0, 100%, 50%)"

# Convert to CMYK representation
cmyk_value = color1.to_cmyk()  # Returns "cmyk(0%, 100%, 100%, 0%)"

# Convert to HSV representation
hsv_value = color1.to_hsv()  # Returns "hsv(0, 100%, 100%)"

# Convert to CSS representation (RGB)
css_value = color1.to_css()  # Returns "rgb(255, 0, 0)"

Color Manipulation

The Color class also provides methods for color manipulation, such as inverting the color, calculating brightness, generating a color palette, among others.

# Invert the color
inverted_color = color1.invert()

# Calculate the brightness of the color
brightness = color1.brightness()

# Generate a color palette
palette = color1.generate_palette(5)

Converter Class

The Converter class is a subclass of Color and adds additional functionalities for converting color values between different representations.

Creating a Converter Object

You can create a Converter object in the same ways as a Color object:

from chromify import Converter

# Create a Converter object from a CSS representation
converter1 = Converter("#FF0000")
converter2 = Converter("rgb(255, 0, 0)")
converter3 = Converter("hsl(0, 100%, 50%)")

# Create a Converter object from RGB values
converter4 = Converter(255, 0, 0)

# Create a Converter object from another Color object
converter5 = Converter(color1)

Color Conversion

The Converter class provides additional methods to convert color values between different representations. You can use the following methods:

# Convert to HEX representation
hex_value = converter1.to_hex()  # Returns "#FF0000"

# Convert to HSL representation
hsl_value = converter1.to_hsl()  # Returns "hsl(0, 100%, 50%)"

# Convert to CMYK representation
cmyk_value = converter1.to_cmyk()  # Returns "cmyk(0%, 100%, 100%, 0%)"

# Convert to HSV representation
hsv_value = converter1.to_hsv()  # Returns "hsv(0, 100%, 100%)"

# Convert to CSS representation (RGB)
css_value = converter1.to_css()  # Returns "rgb(255, 0, 0)"

License

MIT License, to view the license details, click here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Chromify-1.0.4.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

Chromify-1.0.4-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file Chromify-1.0.4.tar.gz.

File metadata

  • Download URL: Chromify-1.0.4.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for Chromify-1.0.4.tar.gz
Algorithm Hash digest
SHA256 445f59fa53e22dc0fafea4365e896b636450afecf6e2fcb5b22040ed7f9a8156
MD5 2e35d1ae5d14a208a3c59f0ab45fda1c
BLAKE2b-256 32e142a36a047f64cc4c5268b8bcbce9bfe9123dbae3e8cc37fa08994b98a229

See more details on using hashes here.

File details

Details for the file Chromify-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: Chromify-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for Chromify-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 be6a4caae5a9168671aab9f09f21ddb85b2d97a8098bb897e5e64f0f2c8f9586
MD5 d6c9a5ad81ad2ca830f2a447930ea84d
BLAKE2b-256 b48f376dc66e65cf1373bdf9ce8b1b776e14c7a82c43c47afc3994705d5eced8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page