Skip to main content

Universal design tokens and themes for Python applications

Project description

turbo-themes

PyPI Python License

Universal design tokens and theme management for Python applications.

Features

  • 9 curated themes from Catppuccin (4 variants), Dracula, GitHub (light/dark), and Bulma (light/dark)
  • Design tokens as typed Python dataclasses
  • CSS variable generation for web integration
  • Type-safe with full type hints and mypy strict mode
  • Lightweight: single runtime dependency (python-dateutil)

Installation

pip install turbo-themes
# or
uv add turbo-themes

Quick Start

Access Theme Colors

from turbo_themes import THEMES

# Get a specific theme
mocha = THEMES["catppuccin-mocha"]
print(mocha.colors.primary)      # "#89b4fa"
print(mocha.colors.background)   # "#1e1e2e"
print(mocha.meta.name)           # "Catppuccin Mocha"
print(mocha.meta.variant)        # "dark"

Theme Manager

from turbo_themes import ThemeManager

manager = ThemeManager()

# Set and apply a theme
manager.set_theme("catppuccin-mocha")
css_vars = manager.apply_theme_to_css_variables()

# Generate CSS custom properties
for var_name, value in css_vars.items():
    print(f"--{var_name}: {value};")

List Available Themes

from turbo_themes import THEMES, list_themes

# Get all theme names
themes = list_themes()
print(themes)
# ['bulma-dark', 'bulma-light', 'catppuccin-frappe', 'catppuccin-latte',
#  'catppuccin-macchiato', 'catppuccin-mocha', 'dracula', 'github-dark', 'github-light']

# Filter by variant
dark_themes = [name for name, theme in THEMES.items() if theme.meta.variant == "dark"]

Available Themes

Theme Variant Source
catppuccin-mocha dark catppuccin.com
catppuccin-macchiato dark catppuccin.com
catppuccin-frappe dark catppuccin.com
catppuccin-latte light catppuccin.com
dracula dark draculatheme.com
github-dark dark primer.style
github-light light primer.style
bulma-dark dark bulma.io
bulma-light light bulma.io

Theme Structure

Each theme provides:

theme.colors.primary       # Primary accent color
theme.colors.secondary     # Secondary accent color
theme.colors.background    # Background color
theme.colors.surface       # Surface/card color
theme.colors.text          # Primary text color
theme.colors.text_muted    # Muted/secondary text
theme.colors.border        # Border color
theme.colors.error         # Error state color
theme.colors.warning       # Warning state color
theme.colors.success       # Success state color
theme.colors.info          # Info state color

theme.meta.name            # Display name
theme.meta.variant         # "light" or "dark"
theme.meta.source          # Source project URL

Integration Examples

Flask/Jinja2

from flask import Flask, render_template
from turbo_themes import ThemeManager

app = Flask(__name__)
manager = ThemeManager()

@app.route("/")
def index():
    manager.set_theme("catppuccin-mocha")
    css_vars = manager.apply_theme_to_css_variables()
    return render_template("index.html", theme_vars=css_vars)

Django

from turbo_themes import THEMES

def get_theme_context(theme_name: str) -> dict:
    theme = THEMES.get(theme_name, THEMES["catppuccin-mocha"])
    return {
        "primary_color": theme.colors.primary,
        "background_color": theme.colors.background,
        "text_color": theme.colors.text,
    }

Multi-Platform

This package is part of the turbo-themes ecosystem:

  • npm: @lgtm-hq/turbo-themes - TypeScript/JavaScript
  • PyPI: turbo-themes - Python (this package)
  • RubyGems: turbo-themes - Ruby/Jekyll
  • Swift: Via Swift Package Manager

All packages share the same design tokens and color values.

Links

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

turbo_themes-0.20.2.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turbo_themes-0.20.2-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file turbo_themes-0.20.2.tar.gz.

File metadata

  • Download URL: turbo_themes-0.20.2.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for turbo_themes-0.20.2.tar.gz
Algorithm Hash digest
SHA256 d9079d1861838c64f41358374e56afd8e4776ece4d111e04f640bb39f0e96c9e
MD5 5be546809bf3deb1618dbf9a59603094
BLAKE2b-256 6748cb3e9ec9ae5d5ce3583e07e9717ef3fdc05eb7dfc7734c4057f86542cdc1

See more details on using hashes here.

File details

Details for the file turbo_themes-0.20.2-py3-none-any.whl.

File metadata

  • Download URL: turbo_themes-0.20.2-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for turbo_themes-0.20.2-py3-none-any.whl
Algorithm Hash digest
SHA256 098d59657106ecf3d5fb59b245f504d5ed1bb6a7efdeba0c15c1acfb7d8d2885
MD5 2dc2df0be48f1baaf7bbb9f474a7a65e
BLAKE2b-256 3dad94a05b01e0fd0d58dbbdf777d43c68f9f01fa02ee0c800bac24d4c368964

See more details on using hashes here.

Supported by

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