# Qt-Theme-Manager for PyQt5/PyQt6/PySide6
[](https://github.com/scottlz0310/Qt-Theme-Manager/actions/workflows/ci-cd-tests.yml)
[](https://badge.fury.io/py/qt-theme-manager)
[](https://pypi.org/project/qt-theme-manager/)
[](https://opensource.org/licenses/MIT)
A **pure theme management library** for PyQt5/PyQt6/PySide6 applications with automatic Qt framework detection, providing dynamic theme switching and 16+ built-in themes. **v1.0.1 - Production Ready!**
## 🎯 ライブラリ分離思想
### 背景と目的
Qt-Theme-Managerは、**純粋なライブラリ**として設計されており、テーマ管理の核となる機能に特化しています。この設計思想は、以下の原則に基づいています:
#### 関心の分離による保守性向上
- **ライブラリコア**: テーマ管理、スタイルシート生成、Qt統合機能
- **GUIツール**: テーマエディタ、プレビューアプリケーション(別リポジトリ: qt-theme-studio)
- **明確な責任分界**: 各コンポーネントが独立した責任を持つ
#### 外部開発者の貢献促進
- **シンプルなAPI**: 最小限の依存関係で使いやすいインターフェース
- **モジュラー設計**: 機能ごとに独立したモジュール構造
- **拡張性**: カスタムテーマやプラグインの開発が容易
#### 長期的な持続可能性
- **独立したリリースサイクル**: ライブラリとGUIツールの個別更新
- **軽量な配布**: 必要最小限のファイルサイズ
- **後方互換性**: 既存APIの安定性保証
### 利点
1. **開発効率の向上**: 関心の分離により、各部分の開発・テスト・保守が独立して行える
2. **コードの再利用性**: ライブラリ機能を他のプロジェクトで簡単に利用可能
3. **品質の向上**: 焦点を絞った開発により、より高品質なコードを実現
4. **コミュニティの拡大**: シンプルな構造により、外部開発者の参加が促進される
### アーキテクチャ
```
qt-theme-manager (ライブラリ)
├── qt_theme_manager/ # コアライブラリパッケージ
│ ├── qt/ # Qt統合モジュール
│ ├── cli/ # コマンドライン機能
│ └── config/ # 設定管理
└── 最小限の依存関係
qt-theme-studio (GUIツール - 別リポジトリ)
├── テーマエディタ
├── プレビューアプリケーション
├── 高度な編集機能
└── GUI固有の依存関係
```
この分離により、ライブラリユーザーは軽量で高性能なテーマ管理機能を利用でき、GUI機能が必要な場合は別途qt-theme-studioを使用できます。
## ✨ ライブラリ機能
### 🎯 コア機能
- **動的テーマ切り替え**: 実行時のテーマ変更とスタイル適用
- **Qt自動検出**: PySide6 → PyQt6 → PyQt5の自動選択
- **スタイルシート生成**: テーマ設定からQSSの自動生成
- **設定管理**: テーマ設定の永続化と管理
- **CLI機能**: コマンドライン経由でのテーマ操作
### 🔧 技術的特徴
- **軽量設計**: 最小限の依存関係で高性能
- **クロスプラットフォーム**: Windows/macOS/Linux対応
- **マルチフレームワーク**: PyQt5/PyQt6/PySide6サポート
- **後方互換性**: 既存APIの安定性保証
- **Python 3.9+**: モダンなPython環境に最適化
### ♿ アクセシビリティ
- **WCAG準拠**: 科学的な色彩計算による最適なコントラスト
- **縞模様最適化**: 6%明度コントラストによる読みやすさ向上
- **目の疲労軽減**: 長時間使用に配慮した色彩設計
## Features
- 🎨 **16+ Built-in Themes**: Light, Dark, High Contrast, and colorful themes
- 🔄 **Dynamic Theme Switching**: Change themes at runtime without restarting
- 💾 **Persistent Settings**: Theme preferences are automatically saved
- 🎯 **Easy Integration**: Simple API for applying themes to widgets/applications
- ⚡ **QSS Generation**: Automatic stylesheet generation from theme configurations
- 📟 **CLI Support**: Command-line theme management
- ♿ **Accessibility Features**: WCAG-compliant color calculations and contrast optimization
- 🔧 **Qt Auto-Detection**: Automatic framework detection (PySide6/PyQt6/PyQt5)
- 📦 **Lightweight**: Minimal dependencies for optimal performance
## 🚀 30秒クイックスタート
**3行のコードでQt アプリに美しいテーマを追加:**
```python
from qt_theme_manager import apply_theme_to_widget
# ウィジェットに現在のテーマを適用
apply_theme_to_widget(your_widget)
```
**動的なテーマ切り替え:**
```python
from qt_theme_manager import ThemeController
controller = ThemeController()
controller.set_theme("dark") # "light", "blue", "cyberpunk"など
controller.apply_theme_to_application()
```
**CLIでのテーマ管理:**
```bash
# インストール
pip install qt-theme-manager[pyqt6]
# テーマ一覧表示
qt-theme-manager list
# テーマ切り替え
qt-theme-manager set dark
```
**16の美しいテーマが利用可能:** `dark`, `light`, `blue`, `green`, `cyberpunk`, `ocean`など
### GUIツールについて
テーマエディタやプレビューアプリケーションは、別リポジトリ(**qt-theme-studio**)に移行されました。
ライブラリとしての機能に集中することで、より軽量で高性能なテーマ管理を実現しています。
---
## Installation
### Option 1: Install from PyPI (recommended)
```bash
# Basic installation
pip install qt-theme-manager
# Install with your preferred Qt framework
pip install qt-theme-manager[pyqt6] # For PyQt6 (recommended)
pip install qt-theme-manager[pyqt5] # For PyQt5
pip install qt-theme-manager[pyside6] # For PySide6
# Install with all Qt frameworks
pip install qt-theme-manager[all]
```
### Option 2: Install from source (for developers)
```bash
git clone https://github.com/scottlz0310/Qt-Theme-Manager.git
cd Qt-Theme-Manager
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # Windows
# Install with your preferred Qt framework
pip install -e .[pyqt6] # For PyQt6
# pip install -e .[pyqt5] # For PyQt5
# pip install -e .[pyside6] # For PySide6
```
### Requirements
- Python 3.9+
- PyQt5, PyQt6, or PySide6 (for GUI functionality)
## Quick Start
### Basic Usage
```python
from qt_theme_manager.qt.controller import apply_theme_to_widget
from PyQt5.QtWidgets import QApplication, QMainWindow
app = QApplication([])
window = QMainWindow()
# Apply current theme to widget
apply_theme_to_widget(window)
window.show()
app.exec_()
```
### Using ThemeController
```python
from qt_theme_manager.qt.controller import ThemeController
# Initialize theme controller
controller = ThemeController()
# Get available themes
themes = controller.get_available_themes()
print("Available themes:", list(themes.keys()))
# Switch theme
controller.set_theme("dark")
# Apply to application
controller.apply_theme_to_application()
```
## Command Line Interface
### 🖥️ CLI機能
Qt-Theme-Managerは、コマンドライン経由でのテーマ管理をサポートしています:
```bash
# 利用可能なテーマ一覧を表示
qt-theme-manager list
# 現在のテーマを表示
qt-theme-manager current
# テーマを設定
qt-theme-manager set dark
# テーマをQSSファイルにエクスポート
qt-theme-manager export dark dark_theme.qss
# ヘルプを表示
qt-theme-manager --help
```
### 🎨 GUIツールについて(移行済み)
テーマエディタやプレビューアプリケーションなどのGUIツールは、**qt-theme-studio**リポジトリに移行されました:
- **テーマエディタ**: 高度なテーマ作成・編集機能
- **プレビューアプリケーション**: リアルタイムテーマプレビュー
- **Zebraパターンエディタ**: アクセシビリティ対応の縞模様生成
これらのツールを使用する場合は、qt-theme-studioリポジトリをご利用ください。
### ♿ アクセシビリティ機能
ライブラリには以下のアクセシビリティ機能が組み込まれています:
```python
# 縞模様の自動最適化
list_widget.setAlternatingRowColors(True)
controller.apply_theme_to_widget(list_widget)
# WCAG準拠の色彩が自動適用されます
```
### レガシーCLIメソッド
高度なユーザーやスクリプト用:
```bash
# 推奨方法
qt-theme-manager list
qt-theme-manager set dark
qt-theme-manager export dark dark_theme.qss
qt-theme-manager current
# レガシーメソッド
python -m qt_theme_manager.cli.main list
python -m qt_theme_manager.cli.main set dark
python -m qt_theme_manager.main current
```
## Available Themes
The library includes 16 built-in themes:
### Core Themes
- **light** - Light mode with bright background
- **dark** - Dark mode with low-strain colors
- **high_contrast** - High contrast for accessibility
### Color Themes
- **blue** - Professional blue-based theme
- **green** - Natural green-based theme
- **purple** - Elegant purple-based theme
- **orange** - Warm orange-based theme
- **pink** - Playful pink-based theme
- **red** - Bold red-based theme
- **teal** - Calm teal-based theme
- **yellow** - Bright yellow-based theme
- **gray** - Simple gray-based theme
- **sepia** - Eye-friendly sepia theme
- **cyberpunk** - Neon cyberpunk theme
- **forest** - Natural forest theme
- **ocean** - Deep ocean blue theme
## Configuration
Themes are defined in `config/theme_settings.json`. Each theme includes:
- **Basic Colors**: background, text, primary, accent
- **Component Styles**: buttons, inputs, panels, toolbars
- **Text Variants**: primary, secondary, muted, success, warning, error
### Example Theme Configuration
```json
{
"dark": {
"name": "dark",
"display_name": "ダークモード",
"description": "暗い背景の低負荷テーマ",
"backgroundColor": "#1a1a1a",
"textColor": "#eeeeee",
"primaryColor": "#222831",
"accentColor": "#00adb5",
"button": {
"background": "#4a5568",
"text": "#ffffff",
"hover": "#00adb5"
}
}
}
```
## Advanced Usage
### Custom Theme Configuration
```python
from qt_theme_manager.qt.controller import ThemeController
# Use custom config file
controller = ThemeController("/path/to/custom/config.json")
```
### Theme Preview Window
```python
from qt_theme_manager.qt.preview import show_preview
# Show interactive preview window
preview_window = show_preview()
```
### Manual QSS Generation
```python
from qt_theme_manager.qt.stylesheet import StylesheetGenerator
theme_config = {...} # Your theme configuration
generator = StylesheetGenerator(theme_config)
# Generate complete stylesheet
qss = generator.generate_qss()
# Generate specific widget styles
button_qss = generator.generate_widget_qss('button')
```
## Project Structure
```
qt_theme_manager/ # ライブラリコアパッケージ
├── __init__.py # パブリックAPI
├── main.py # CLIエントリーポイント
├── config/
│ └── theme_settings.json # テーマ定義
├── qt/ # Qt統合モジュール
│ ├── __init__.py
│ ├── detection.py # Qt自動検出
│ ├── loader.py # 設定ファイル読み込み
│ ├── stylesheet.py # QSS生成
│ ├── advanced_stylesheet.py # 高度なスタイル機能
│ └── controller.py # テーマ管理
└── cli/ # CLI機能
├── __init__.py
└── themectl.py # CLIインターフェース
```
### 移行されたGUIツール
以下のGUIツールは**qt-theme-studio**リポジトリに移行されました:
- テーマエディタ
- プレビューアプリケーション
- Zebraパターンエディタ
- 各種起動スクリプト
## Testing
Run the test suite to verify functionality:
```bash
python test_qt_theme_manager.py
```
This will test:
- Theme loading and configuration
- Stylesheet generation
- Theme switching
- CLI functionality
- QSS export
## API Reference
### ThemeController
Main class for theme management.
#### Methods
- `get_available_themes()` - Get all available themes
- `get_current_theme_name()` - Get current active theme
- `set_theme(theme_name, save_settings=True)` - Switch to specified theme
- `apply_theme_to_widget(widget)` - Apply theme to specific widget
- `apply_theme_to_application(app=None)` - Apply theme to entire application
- `export_qss(output_path, theme_name=None)` - Export QSS to file
### ThemeLoader
Handles loading and saving theme configurations.
#### Methods
- `load_settings()` - Load theme configuration from file
- `get_available_themes()` - Get available themes dict
- `get_current_theme()` - Get current theme name
- `update_current_theme(theme_name)` - Update and save current theme
### StylesheetGenerator
Generates QSS stylesheets from theme configurations.
#### Methods
- `generate_qss()` - Generate complete QSS stylesheet
- `generate_widget_qss(widget_type)` - Generate QSS for specific widget type
- `validate_theme_config(theme_config)` - Validate theme configuration
## License
[Add your license information here]
## Contributing
[Add contribution guidelines here]
## Changelog
### Version 0.0.1 (Initial Release)
- Basic theme management functionality
- 16 built-in themes
- CLI interface
- GUI preview window
- QSS export functionality
Raw data
{
"_id": null,
"home_page": "https://github.com/scottlz0310/Qt-Theme-Manager",
"name": "qt-theme-manager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "scottlz0310 <scott.lz0310@gmail.com>",
"keywords": "theme, qt, styling, pyside, pyqt, library, ui, desktop, theme-management, stylesheet",
"author": "scottlz0310",
"author_email": "scottlz0310 <scott.lz0310@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/12/dd/6f2c1c110006b722f86308762387e7cf93f2e5fbce5d4e62abc5426f4068/qt_theme_manager-1.0.1.tar.gz",
"platform": null,
"description": "# Qt-Theme-Manager for PyQt5/PyQt6/PySide6\n\n[](https://github.com/scottlz0310/Qt-Theme-Manager/actions/workflows/ci-cd-tests.yml)\n[](https://badge.fury.io/py/qt-theme-manager)\n[](https://pypi.org/project/qt-theme-manager/)\n[](https://opensource.org/licenses/MIT)\n\nA **pure theme management library** for PyQt5/PyQt6/PySide6 applications with automatic Qt framework detection, providing dynamic theme switching and 16+ built-in themes. **v1.0.1 - Production Ready!**\n\n## \ud83c\udfaf \u30e9\u30a4\u30d6\u30e9\u30ea\u5206\u96e2\u601d\u60f3\n\n### \u80cc\u666f\u3068\u76ee\u7684\n\nQt-Theme-Manager\u306f\u3001**\u7d14\u7c8b\u306a\u30e9\u30a4\u30d6\u30e9\u30ea**\u3068\u3057\u3066\u8a2d\u8a08\u3055\u308c\u3066\u304a\u308a\u3001\u30c6\u30fc\u30de\u7ba1\u7406\u306e\u6838\u3068\u306a\u308b\u6a5f\u80fd\u306b\u7279\u5316\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u8a2d\u8a08\u601d\u60f3\u306f\u3001\u4ee5\u4e0b\u306e\u539f\u5247\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\uff1a\n\n#### \u95a2\u5fc3\u306e\u5206\u96e2\u306b\u3088\u308b\u4fdd\u5b88\u6027\u5411\u4e0a\n- **\u30e9\u30a4\u30d6\u30e9\u30ea\u30b3\u30a2**: \u30c6\u30fc\u30de\u7ba1\u7406\u3001\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u751f\u6210\u3001Qt\u7d71\u5408\u6a5f\u80fd\n- **GUI\u30c4\u30fc\u30eb**: \u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3001\u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff08\u5225\u30ea\u30dd\u30b8\u30c8\u30ea: qt-theme-studio\uff09\n- **\u660e\u78ba\u306a\u8cac\u4efb\u5206\u754c**: \u5404\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u72ec\u7acb\u3057\u305f\u8cac\u4efb\u3092\u6301\u3064\n\n#### \u5916\u90e8\u958b\u767a\u8005\u306e\u8ca2\u732e\u4fc3\u9032\n- **\u30b7\u30f3\u30d7\u30eb\u306aAPI**: \u6700\u5c0f\u9650\u306e\u4f9d\u5b58\u95a2\u4fc2\u3067\u4f7f\u3044\u3084\u3059\u3044\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\n- **\u30e2\u30b8\u30e5\u30e9\u30fc\u8a2d\u8a08**: \u6a5f\u80fd\u3054\u3068\u306b\u72ec\u7acb\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u69cb\u9020\n- **\u62e1\u5f35\u6027**: \u30ab\u30b9\u30bf\u30e0\u30c6\u30fc\u30de\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u958b\u767a\u304c\u5bb9\u6613\n\n#### \u9577\u671f\u7684\u306a\u6301\u7d9a\u53ef\u80fd\u6027\n- **\u72ec\u7acb\u3057\u305f\u30ea\u30ea\u30fc\u30b9\u30b5\u30a4\u30af\u30eb**: \u30e9\u30a4\u30d6\u30e9\u30ea\u3068GUI\u30c4\u30fc\u30eb\u306e\u500b\u5225\u66f4\u65b0\n- **\u8efd\u91cf\u306a\u914d\u5e03**: \u5fc5\u8981\u6700\u5c0f\u9650\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\n- **\u5f8c\u65b9\u4e92\u63db\u6027**: \u65e2\u5b58API\u306e\u5b89\u5b9a\u6027\u4fdd\u8a3c\n\n### \u5229\u70b9\n\n1. **\u958b\u767a\u52b9\u7387\u306e\u5411\u4e0a**: \u95a2\u5fc3\u306e\u5206\u96e2\u306b\u3088\u308a\u3001\u5404\u90e8\u5206\u306e\u958b\u767a\u30fb\u30c6\u30b9\u30c8\u30fb\u4fdd\u5b88\u304c\u72ec\u7acb\u3057\u3066\u884c\u3048\u308b\n2. **\u30b3\u30fc\u30c9\u306e\u518d\u5229\u7528\u6027**: \u30e9\u30a4\u30d6\u30e9\u30ea\u6a5f\u80fd\u3092\u4ed6\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u7c21\u5358\u306b\u5229\u7528\u53ef\u80fd\n3. **\u54c1\u8cea\u306e\u5411\u4e0a**: \u7126\u70b9\u3092\u7d5e\u3063\u305f\u958b\u767a\u306b\u3088\u308a\u3001\u3088\u308a\u9ad8\u54c1\u8cea\u306a\u30b3\u30fc\u30c9\u3092\u5b9f\u73fe\n4. **\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u306e\u62e1\u5927**: \u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020\u306b\u3088\u308a\u3001\u5916\u90e8\u958b\u767a\u8005\u306e\u53c2\u52a0\u304c\u4fc3\u9032\u3055\u308c\u308b\n\n### \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\n\n```\nqt-theme-manager (\u30e9\u30a4\u30d6\u30e9\u30ea)\n\u251c\u2500\u2500 qt_theme_manager/ # \u30b3\u30a2\u30e9\u30a4\u30d6\u30e9\u30ea\u30d1\u30c3\u30b1\u30fc\u30b8\n\u2502 \u251c\u2500\u2500 qt/ # Qt\u7d71\u5408\u30e2\u30b8\u30e5\u30fc\u30eb\n\u2502 \u251c\u2500\u2500 cli/ # \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u6a5f\u80fd\n\u2502 \u2514\u2500\u2500 config/ # \u8a2d\u5b9a\u7ba1\u7406\n\u2514\u2500\u2500 \u6700\u5c0f\u9650\u306e\u4f9d\u5b58\u95a2\u4fc2\n\nqt-theme-studio (GUI\u30c4\u30fc\u30eb - \u5225\u30ea\u30dd\u30b8\u30c8\u30ea)\n\u251c\u2500\u2500 \u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\n\u251c\u2500\u2500 \u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\n\u251c\u2500\u2500 \u9ad8\u5ea6\u306a\u7de8\u96c6\u6a5f\u80fd\n\u2514\u2500\u2500 GUI\u56fa\u6709\u306e\u4f9d\u5b58\u95a2\u4fc2\n```\n\n\u3053\u306e\u5206\u96e2\u306b\u3088\u308a\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u30e6\u30fc\u30b6\u30fc\u306f\u8efd\u91cf\u3067\u9ad8\u6027\u80fd\u306a\u30c6\u30fc\u30de\u7ba1\u7406\u6a5f\u80fd\u3092\u5229\u7528\u3067\u304d\u3001GUI\u6a5f\u80fd\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u5225\u9014qt-theme-studio\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\n\n## \u2728 \u30e9\u30a4\u30d6\u30e9\u30ea\u6a5f\u80fd\n\n### \ud83c\udfaf \u30b3\u30a2\u6a5f\u80fd\n- **\u52d5\u7684\u30c6\u30fc\u30de\u5207\u308a\u66ff\u3048**: \u5b9f\u884c\u6642\u306e\u30c6\u30fc\u30de\u5909\u66f4\u3068\u30b9\u30bf\u30a4\u30eb\u9069\u7528\n- **Qt\u81ea\u52d5\u691c\u51fa**: PySide6 \u2192 PyQt6 \u2192 PyQt5\u306e\u81ea\u52d5\u9078\u629e\n- **\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u751f\u6210**: \u30c6\u30fc\u30de\u8a2d\u5b9a\u304b\u3089QSS\u306e\u81ea\u52d5\u751f\u6210\n- **\u8a2d\u5b9a\u7ba1\u7406**: \u30c6\u30fc\u30de\u8a2d\u5b9a\u306e\u6c38\u7d9a\u5316\u3068\u7ba1\u7406\n- **CLI\u6a5f\u80fd**: \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u7d4c\u7531\u3067\u306e\u30c6\u30fc\u30de\u64cd\u4f5c\n\n### \ud83d\udd27 \u6280\u8853\u7684\u7279\u5fb4\n- **\u8efd\u91cf\u8a2d\u8a08**: \u6700\u5c0f\u9650\u306e\u4f9d\u5b58\u95a2\u4fc2\u3067\u9ad8\u6027\u80fd\n- **\u30af\u30ed\u30b9\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0**: Windows/macOS/Linux\u5bfe\u5fdc\n- **\u30de\u30eb\u30c1\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af**: PyQt5/PyQt6/PySide6\u30b5\u30dd\u30fc\u30c8\n- **\u5f8c\u65b9\u4e92\u63db\u6027**: \u65e2\u5b58API\u306e\u5b89\u5b9a\u6027\u4fdd\u8a3c\n- **Python 3.9+**: \u30e2\u30c0\u30f3\u306aPython\u74b0\u5883\u306b\u6700\u9069\u5316\n\n### \u267f \u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\n- **WCAG\u6e96\u62e0**: \u79d1\u5b66\u7684\u306a\u8272\u5f69\u8a08\u7b97\u306b\u3088\u308b\u6700\u9069\u306a\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\n- **\u7e1e\u6a21\u69d8\u6700\u9069\u5316**: 6%\u660e\u5ea6\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u306b\u3088\u308b\u8aad\u307f\u3084\u3059\u3055\u5411\u4e0a\n- **\u76ee\u306e\u75b2\u52b4\u8efd\u6e1b**: \u9577\u6642\u9593\u4f7f\u7528\u306b\u914d\u616e\u3057\u305f\u8272\u5f69\u8a2d\u8a08\n\n## Features\n\n- \ud83c\udfa8 **16+ Built-in Themes**: Light, Dark, High Contrast, and colorful themes\n- \ud83d\udd04 **Dynamic Theme Switching**: Change themes at runtime without restarting\n- \ud83d\udcbe **Persistent Settings**: Theme preferences are automatically saved\n- \ud83c\udfaf **Easy Integration**: Simple API for applying themes to widgets/applications\n- \u26a1 **QSS Generation**: Automatic stylesheet generation from theme configurations\n- \ud83d\udcdf **CLI Support**: Command-line theme management\n- \u267f **Accessibility Features**: WCAG-compliant color calculations and contrast optimization\n- \ud83d\udd27 **Qt Auto-Detection**: Automatic framework detection (PySide6/PyQt6/PyQt5)\n- \ud83d\udce6 **Lightweight**: Minimal dependencies for optimal performance\n\n## \ud83d\ude80 30\u79d2\u30af\u30a4\u30c3\u30af\u30b9\u30bf\u30fc\u30c8\n\n**3\u884c\u306e\u30b3\u30fc\u30c9\u3067Qt \u30a2\u30d7\u30ea\u306b\u7f8e\u3057\u3044\u30c6\u30fc\u30de\u3092\u8ffd\u52a0:**\n\n```python\nfrom qt_theme_manager import apply_theme_to_widget\n\n# \u30a6\u30a3\u30b8\u30a7\u30c3\u30c8\u306b\u73fe\u5728\u306e\u30c6\u30fc\u30de\u3092\u9069\u7528\napply_theme_to_widget(your_widget)\n```\n\n**\u52d5\u7684\u306a\u30c6\u30fc\u30de\u5207\u308a\u66ff\u3048:**\n\n```python\nfrom qt_theme_manager import ThemeController\n\ncontroller = ThemeController()\ncontroller.set_theme(\"dark\") # \"light\", \"blue\", \"cyberpunk\"\u306a\u3069\ncontroller.apply_theme_to_application()\n```\n\n**CLI\u3067\u306e\u30c6\u30fc\u30de\u7ba1\u7406:**\n\n```bash\n# \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\npip install qt-theme-manager[pyqt6]\n\n# \u30c6\u30fc\u30de\u4e00\u89a7\u8868\u793a\nqt-theme-manager list\n\n# \u30c6\u30fc\u30de\u5207\u308a\u66ff\u3048\nqt-theme-manager set dark\n```\n\n**16\u306e\u7f8e\u3057\u3044\u30c6\u30fc\u30de\u304c\u5229\u7528\u53ef\u80fd:** `dark`, `light`, `blue`, `green`, `cyberpunk`, `ocean`\u306a\u3069\n\n### GUI\u30c4\u30fc\u30eb\u306b\u3064\u3044\u3066\n\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3084\u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u5225\u30ea\u30dd\u30b8\u30c8\u30ea\uff08**qt-theme-studio**\uff09\u306b\u79fb\u884c\u3055\u308c\u307e\u3057\u305f\u3002\n\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3057\u3066\u306e\u6a5f\u80fd\u306b\u96c6\u4e2d\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u8efd\u91cf\u3067\u9ad8\u6027\u80fd\u306a\u30c6\u30fc\u30de\u7ba1\u7406\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002\n\n---\n\n## Installation\n\n### Option 1: Install from PyPI (recommended)\n\n```bash\n# Basic installation\npip install qt-theme-manager\n\n# Install with your preferred Qt framework\npip install qt-theme-manager[pyqt6] # For PyQt6 (recommended)\npip install qt-theme-manager[pyqt5] # For PyQt5 \npip install qt-theme-manager[pyside6] # For PySide6\n\n# Install with all Qt frameworks\npip install qt-theme-manager[all]\n```\n\n\n\n### Option 2: Install from source (for developers)\n\n```bash\ngit clone https://github.com/scottlz0310/Qt-Theme-Manager.git\ncd Qt-Theme-Manager\n\n# Create virtual environment (recommended)\npython -m venv venv\nsource venv/bin/activate # Linux/Mac\n# or: venv\\Scripts\\activate # Windows\n\n# Install with your preferred Qt framework\npip install -e .[pyqt6] # For PyQt6\n# pip install -e .[pyqt5] # For PyQt5\n# pip install -e .[pyside6] # For PySide6\n```\n\n### Requirements\n\n- Python 3.9+\n- PyQt5, PyQt6, or PySide6 (for GUI functionality)\n\n## Quick Start\n\n### Basic Usage\n\n```python\nfrom qt_theme_manager.qt.controller import apply_theme_to_widget\nfrom PyQt5.QtWidgets import QApplication, QMainWindow\n\napp = QApplication([])\nwindow = QMainWindow()\n\n# Apply current theme to widget\napply_theme_to_widget(window)\n\nwindow.show()\napp.exec_()\n```\n\n### Using ThemeController\n\n```python\nfrom qt_theme_manager.qt.controller import ThemeController\n\n# Initialize theme controller\ncontroller = ThemeController()\n\n# Get available themes\nthemes = controller.get_available_themes()\nprint(\"Available themes:\", list(themes.keys()))\n\n# Switch theme\ncontroller.set_theme(\"dark\")\n\n# Apply to application\ncontroller.apply_theme_to_application()\n```\n\n## Command Line Interface\n\n### \ud83d\udda5\ufe0f CLI\u6a5f\u80fd\n\nQt-Theme-Manager\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u7d4c\u7531\u3067\u306e\u30c6\u30fc\u30de\u7ba1\u7406\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\uff1a\n\n```bash\n# \u5229\u7528\u53ef\u80fd\u306a\u30c6\u30fc\u30de\u4e00\u89a7\u3092\u8868\u793a\nqt-theme-manager list\n\n# \u73fe\u5728\u306e\u30c6\u30fc\u30de\u3092\u8868\u793a\nqt-theme-manager current\n\n# \u30c6\u30fc\u30de\u3092\u8a2d\u5b9a\nqt-theme-manager set dark\n\n# \u30c6\u30fc\u30de\u3092QSS\u30d5\u30a1\u30a4\u30eb\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\nqt-theme-manager export dark dark_theme.qss\n\n# \u30d8\u30eb\u30d7\u3092\u8868\u793a\nqt-theme-manager --help\n```\n\n### \ud83c\udfa8 GUI\u30c4\u30fc\u30eb\u306b\u3064\u3044\u3066\uff08\u79fb\u884c\u6e08\u307f\uff09\n\n\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3084\u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306a\u3069\u306eGUI\u30c4\u30fc\u30eb\u306f\u3001**qt-theme-studio**\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u79fb\u884c\u3055\u308c\u307e\u3057\u305f\uff1a\n\n- **\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf**: \u9ad8\u5ea6\u306a\u30c6\u30fc\u30de\u4f5c\u6210\u30fb\u7de8\u96c6\u6a5f\u80fd\n- **\u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3**: \u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c6\u30fc\u30de\u30d7\u30ec\u30d3\u30e5\u30fc\n- **Zebra\u30d1\u30bf\u30fc\u30f3\u30a8\u30c7\u30a3\u30bf**: \u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u5bfe\u5fdc\u306e\u7e1e\u6a21\u69d8\u751f\u6210\n\n\u3053\u308c\u3089\u306e\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001qt-theme-studio\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002\n\n### \u267f \u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u6a5f\u80fd\n\n\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u4ee5\u4e0b\u306e\u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u6a5f\u80fd\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u307e\u3059\uff1a\n\n```python\n# \u7e1e\u6a21\u69d8\u306e\u81ea\u52d5\u6700\u9069\u5316\nlist_widget.setAlternatingRowColors(True)\ncontroller.apply_theme_to_widget(list_widget)\n# WCAG\u6e96\u62e0\u306e\u8272\u5f69\u304c\u81ea\u52d5\u9069\u7528\u3055\u308c\u307e\u3059\n```\n\n### \u30ec\u30ac\u30b7\u30fcCLI\u30e1\u30bd\u30c3\u30c9\n\n\u9ad8\u5ea6\u306a\u30e6\u30fc\u30b6\u30fc\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u7528\uff1a\n\n```bash\n# \u63a8\u5968\u65b9\u6cd5\nqt-theme-manager list\nqt-theme-manager set dark\nqt-theme-manager export dark dark_theme.qss\nqt-theme-manager current\n\n# \u30ec\u30ac\u30b7\u30fc\u30e1\u30bd\u30c3\u30c9\npython -m qt_theme_manager.cli.main list\npython -m qt_theme_manager.cli.main set dark\npython -m qt_theme_manager.main current\n```\n\n## Available Themes\n\nThe library includes 16 built-in themes:\n\n### Core Themes\n- **light** - Light mode with bright background\n- **dark** - Dark mode with low-strain colors \n- **high_contrast** - High contrast for accessibility\n\n### Color Themes\n- **blue** - Professional blue-based theme\n- **green** - Natural green-based theme\n- **purple** - Elegant purple-based theme\n- **orange** - Warm orange-based theme\n- **pink** - Playful pink-based theme\n- **red** - Bold red-based theme\n- **teal** - Calm teal-based theme\n- **yellow** - Bright yellow-based theme\n- **gray** - Simple gray-based theme\n- **sepia** - Eye-friendly sepia theme\n- **cyberpunk** - Neon cyberpunk theme\n- **forest** - Natural forest theme\n- **ocean** - Deep ocean blue theme\n\n## Configuration\n\nThemes are defined in `config/theme_settings.json`. Each theme includes:\n\n- **Basic Colors**: background, text, primary, accent\n- **Component Styles**: buttons, inputs, panels, toolbars\n- **Text Variants**: primary, secondary, muted, success, warning, error\n\n### Example Theme Configuration\n\n```json\n{\n \"dark\": {\n \"name\": \"dark\",\n \"display_name\": \"\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\",\n \"description\": \"\u6697\u3044\u80cc\u666f\u306e\u4f4e\u8ca0\u8377\u30c6\u30fc\u30de\",\n \"backgroundColor\": \"#1a1a1a\",\n \"textColor\": \"#eeeeee\",\n \"primaryColor\": \"#222831\",\n \"accentColor\": \"#00adb5\",\n \"button\": {\n \"background\": \"#4a5568\",\n \"text\": \"#ffffff\",\n \"hover\": \"#00adb5\"\n }\n }\n}\n```\n\n## Advanced Usage\n\n### Custom Theme Configuration\n\n```python\nfrom qt_theme_manager.qt.controller import ThemeController\n\n# Use custom config file\ncontroller = ThemeController(\"/path/to/custom/config.json\")\n```\n\n### Theme Preview Window\n\n```python\nfrom qt_theme_manager.qt.preview import show_preview\n\n# Show interactive preview window\npreview_window = show_preview()\n```\n\n### Manual QSS Generation\n\n```python\nfrom qt_theme_manager.qt.stylesheet import StylesheetGenerator\n\ntheme_config = {...} # Your theme configuration\ngenerator = StylesheetGenerator(theme_config)\n\n# Generate complete stylesheet\nqss = generator.generate_qss()\n\n# Generate specific widget styles\nbutton_qss = generator.generate_widget_qss('button')\n```\n\n## Project Structure\n\n```\nqt_theme_manager/ # \u30e9\u30a4\u30d6\u30e9\u30ea\u30b3\u30a2\u30d1\u30c3\u30b1\u30fc\u30b8\n\u251c\u2500\u2500 __init__.py # \u30d1\u30d6\u30ea\u30c3\u30afAPI\n\u251c\u2500\u2500 main.py # CLI\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\n\u251c\u2500\u2500 config/\n\u2502 \u2514\u2500\u2500 theme_settings.json # \u30c6\u30fc\u30de\u5b9a\u7fa9\n\u251c\u2500\u2500 qt/ # Qt\u7d71\u5408\u30e2\u30b8\u30e5\u30fc\u30eb\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 detection.py # Qt\u81ea\u52d5\u691c\u51fa\n\u2502 \u251c\u2500\u2500 loader.py # \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\n\u2502 \u251c\u2500\u2500 stylesheet.py # QSS\u751f\u6210\n\u2502 \u251c\u2500\u2500 advanced_stylesheet.py # \u9ad8\u5ea6\u306a\u30b9\u30bf\u30a4\u30eb\u6a5f\u80fd\n\u2502 \u2514\u2500\u2500 controller.py # \u30c6\u30fc\u30de\u7ba1\u7406\n\u2514\u2500\u2500 cli/ # CLI\u6a5f\u80fd\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 themectl.py # CLI\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\n```\n\n### \u79fb\u884c\u3055\u308c\u305fGUI\u30c4\u30fc\u30eb\n\u4ee5\u4e0b\u306eGUI\u30c4\u30fc\u30eb\u306f**qt-theme-studio**\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u79fb\u884c\u3055\u308c\u307e\u3057\u305f\uff1a\n- \u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\n- \u30d7\u30ec\u30d3\u30e5\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \n- Zebra\u30d1\u30bf\u30fc\u30f3\u30a8\u30c7\u30a3\u30bf\n- \u5404\u7a2e\u8d77\u52d5\u30b9\u30af\u30ea\u30d7\u30c8\n\n## Testing\n\nRun the test suite to verify functionality:\n\n```bash\npython test_qt_theme_manager.py\n```\n\nThis will test:\n- Theme loading and configuration\n- Stylesheet generation\n- Theme switching\n- CLI functionality\n- QSS export\n\n## API Reference\n\n### ThemeController\n\nMain class for theme management.\n\n#### Methods\n\n- `get_available_themes()` - Get all available themes\n- `get_current_theme_name()` - Get current active theme\n- `set_theme(theme_name, save_settings=True)` - Switch to specified theme\n- `apply_theme_to_widget(widget)` - Apply theme to specific widget\n- `apply_theme_to_application(app=None)` - Apply theme to entire application\n- `export_qss(output_path, theme_name=None)` - Export QSS to file\n\n### ThemeLoader\n\nHandles loading and saving theme configurations.\n\n#### Methods\n\n- `load_settings()` - Load theme configuration from file\n- `get_available_themes()` - Get available themes dict\n- `get_current_theme()` - Get current theme name\n- `update_current_theme(theme_name)` - Update and save current theme\n\n### StylesheetGenerator\n\nGenerates QSS stylesheets from theme configurations.\n\n#### Methods\n\n- `generate_qss()` - Generate complete QSS stylesheet\n- `generate_widget_qss(widget_type)` - Generate QSS for specific widget type\n- `validate_theme_config(theme_config)` - Validate theme configuration\n\n## License\n\n[Add your license information here]\n\n## Contributing\n\n[Add contribution guidelines here]\n\n## Changelog\n\n### Version 0.0.1 (Initial Release)\n- Basic theme management functionality\n- 16 built-in themes\n- CLI interface\n- GUI preview window\n- QSS export functionality\n",
"bugtrack_url": null,
"license": null,
"summary": "A pure theme management library for PyQt5/PyQt6/PySide6 applications with automatic Qt framework detection",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/scottlz0310/Qt-Theme-Manager/issues",
"Documentation": "https://github.com/scottlz0310/Qt-Theme-Manager/blob/main/README.md",
"Homepage": "https://github.com/scottlz0310/Qt-Theme-Manager",
"Repository": "https://github.com/scottlz0310/Qt-Theme-Manager"
},
"split_keywords": [
"theme",
" qt",
" styling",
" pyside",
" pyqt",
" library",
" ui",
" desktop",
" theme-management",
" stylesheet"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a7cf9b21b98f07ca7779143ab7113cb2cb5a6c7dfeac8b2a358e3c690ea8eac8",
"md5": "b4a605315c950341c5f33f2ec97a317a",
"sha256": "fdadcf72d8d7a6cf3a7608f2a303a20d7cede3e5fe38d5e5b6db89843b31a495"
},
"downloads": -1,
"filename": "qt_theme_manager-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4a605315c950341c5f33f2ec97a317a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 32266,
"upload_time": "2025-08-13T12:25:43",
"upload_time_iso_8601": "2025-08-13T12:25:43.647546Z",
"url": "https://files.pythonhosted.org/packages/a7/cf/9b21b98f07ca7779143ab7113cb2cb5a6c7dfeac8b2a358e3c690ea8eac8/qt_theme_manager-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "12dd6f2c1c110006b722f86308762387e7cf93f2e5fbce5d4e62abc5426f4068",
"md5": "1b2b64ce556691b7152145186c454c7e",
"sha256": "d5eb0a58abb211a056a3d2236e858963ed1c3982300e457798c7e1b54fd2b0e3"
},
"downloads": -1,
"filename": "qt_theme_manager-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "1b2b64ce556691b7152145186c454c7e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 61330,
"upload_time": "2025-08-13T12:25:44",
"upload_time_iso_8601": "2025-08-13T12:25:44.514035Z",
"url": "https://files.pythonhosted.org/packages/12/dd/6f2c1c110006b722f86308762387e7cf93f2e5fbce5d4e62abc5426f4068/qt_theme_manager-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-13 12:25:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scottlz0310",
"github_project": "Qt-Theme-Manager",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "qt-theme-manager"
}