Skip to main content

Terminal color utility

Project description

Theme Manager for Scripts

The Theme Manager script facilitates easy management and validation of themes for your scripts, particularly focusing on the themes.d directory configuration and usage of the Theme object.

Configuration

themes.d Directory

The themes.d directory serves as the repository for your theme files. By default, the Theme Manager looks for theme files in this directory unless specified otherwise.

Configuration File (hue.config)

The configuration file hue.config stores essential settings for the Theme Manager, including:

  • default_theme: Specifies the default theme to load if none is specified explicitly.
  • themes_dir: Defines the directory where theme files (*.theme) are stored.
  • manifest_file: Indicates the file (MANIFEST) containing theme hashes for validation.
  • log_file: Path to the log file (theme.log) for recording theme management activities.

Ensure hue.config is correctly configured to align with your environment and requirements.

Usage

Importing the Theme Object

To utilize themes in your script, import the Theme object from the src module:

from src import Theme

Managing Themes

Loading a Theme

You can load a theme using its file name or the default theme specified in hue.config:

theme_manager = ThemeManager()
theme = theme_manager.get_theme_instance('my_theme.theme')  # Load specific theme

Validating a Theme

Validate a theme against its hash in the manifest file to ensure integrity:

theme_manager = ThemeManager()
valid = theme_manager.validate_theme('my_theme.theme')  # Validate specific theme

Useful Tidbits

  • Dynamic Theme Loading: Themes are dynamically loaded and can be swapped during runtime based on your application's needs.
  • Logging: The Theme Manager logs activities to theme.log, providing visibility into theme loading and validation operations.
  • Extensibility: Customize hue.config and extend the Theme class as per your project's thematic requirements.

Example

hue import ThemeManager


# Initialize ThemeManager instance
theme_manager = ThemeManager()
theme_manager.setup_logging()

# Load and validate a specific theme
theme = theme_manager.get_theme_instance('my_theme.theme')
if theme:
    print(f"Loaded theme: {theme.list_theme_attributes()}")

# Validate the loaded theme
valid = theme_manager.validate_theme('my_theme.theme')
if valid:
    print("Theme validated successfully.")
else:
    print("Failed to validate theme.")

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

huefy-1.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

huefy-1.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file huefy-1.1.0.tar.gz.

File metadata

  • Download URL: huefy-1.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for huefy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9dad91d0583438da5880308230cf74be1d03bc76ed4a6a779ff640a2f9a9cda0
MD5 353ba7b7e93b5a7b242ca0bd0086124f
BLAKE2b-256 089396c7c26d9c7e8baefc0d505369f1f2239b337a96377451ab0d170c4bcc2b

See more details on using hashes here.

File details

Details for the file huefy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: huefy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for huefy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37056bed7cd0f46c118653b9d6513a38eb67ae47a66beca49a0241f9ba621392
MD5 4d76e38a43cc2b3b0a8e154ace766109
BLAKE2b-256 bfb96ebd859616aa4a3908a849ac02c9f7b4f5ddea953fbf491ab9988ddf70f7

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