Skip to main content

Pure Python IDA Pro theme toolkit with widget inspector, stylesheet editor, and VS Code theme converter

Project description

ida-themr ๐ŸŽจ

A pure Python IDA Pro theme toolkit that helps make theming IDA Pro easier. Transform your reversing environment with ease! ๐Ÿš€

CI Status

Overview ๐ŸŒŸ

ida-themr is a powerful toolkit designed to build maintainable IDA Pro color schemes.

Beyond theme conversion, ida-themr also simplifies CSS theme files by resolving variable references and functions, making themes easier to maintain and debug. There is a dearth of information regarding how to make themes etc and I am hoping to consolidate it here for others to benefit! ๐Ÿ› ๏ธ

Screenshots

Here are some pictures demonstrating some of IDA theming toolkit's functionality:

Widget Inspector

Chrome DevTools like element inspector written completely in Python without any external dependencies: Widget Inspector

QT Style Switcher

Allows you to save the Qt style based on your operating system (i.e. Fusion, windowsvista, windows):

Qt Style Switcher

Also a Dark Mode toggler that will go through and set os-dark-theme="true" on every property to toggle Dark Mode. Allows you to save the settings and toggle Dark Mode when IDA starts up.

Stylesheet Editor + QSS Processor

A very rudimentary way to fiddle with the generated stylesheet from IDA Pro and a way to edit the QSS stylesheet w/ some basic helper functions for maintainable themes:

Stylesheet Editor + Processor

Features

  • Theme Conversion: Convert individual VS Code themes to IDA Pro effortlessly. ๐ŸŽญ
  • Batch Processing: Convert all installed VS Code extension themes in one go. ๐Ÿ“ฆ
  • Intelligent Color Mapping: Maps colors between VS Code and IDA Pro using theme keys and nearest-color matching with HSL adjustments. ๐ŸŒˆ
  • Theme Semantics Preservation: Maintains the visual intent of the original theme during conversion. ๐Ÿ–ผ๏ธ
  • Variable Resolution: Replaces ${variable} references with their defined values in CSS files. ๐Ÿ”„
  • Function Simplification: Converts complex functions like @lighten() to base colors for clarity. ๐Ÿงน
  • Error Logging: Provides warnings for undefined variables or malformed function calls. โš ๏ธ
  • Custom Output: Generates new theme files in a specified output directory for easy integration. ๐Ÿ“
  • Well-Tested: Comprehensive unit tests ensure reliability and accuracy in color conversion and CSS processing. โœ…

Installation ๐Ÿ“ฅ

Via HCLI (Recommended for IDA Pro 9.0+)

The easiest way to install ida-themr is through IDA's built-in plugin manager:

# From IDA Pro's HCLI
ida-hcli plugin install ida-themr

Or download from GitHub releases and install manually:

ida-hcli plugin install path/to/ida-themr-X.X.X.zip

Via pip

# Install from PyPI
pip install ida-themr

# Or install from source
pip install -e .

Manual Installation

Get started with ida-themr manually in just a few steps! ๐Ÿš€

  1. Clone the Repository:

    git clone https://github.com/mahmoudimus/ida-themr.git
    cd ida-themr
    
  2. Copy to IDA Pro plugins directory:

    Copy the src/ directory contents to your IDA plugins directory:

    • Linux/macOS: ~/.idapro/plugins/
    • Windows: %APPDATA%\Hex-Rays\IDA Pro\plugins\
  3. No Additional Dependencies Needed: ida-themr is a pure Python tool with no external dependencies beyond the standard library. You're ready to go! ๐Ÿ‘

Usage ๐Ÿ–ฅ๏ธ

Two ways to us it:

Cli + IDA Plugin.

Copy the folders in src and put them in your idaapi.get_user_idadir() directory.

Cli

Included a simple algorithm to port vscode themes to IDA Pro based on a reference IDA Pro template by parsing VS Code theme files (JSONC format), mapping colors to an existing IDA Pro theme, and generating compatible CSS files for IDA Pro.

How It Works ๐Ÿ› ๏ธ

  • Extracting colors from both source (VS Code) and target (IDA Pro) themes.
  • Building mappings to associate colors with theme elements.
  • Using Euclidean distance in RGB space to find the closest color matches when direct matches aren't available.
  • Applying a three-way adjustment in HSL space to fine-tune colors to maintain relative contrast and brightness. We compare the saturation and lightness of the source and destination colors, then adjust the remapped color's saturation and lightness by a fraction of the difference to maintain relative contrast and brightness.
  • Replacing colors in a template CSS file for IDA Pro with the remapped colors.
  • Generating the final theme files.

Supports

  1. Color Parsing: Supports CSS hex formats (#RGB, #RGBA, #RRGGBB, #RRGGBBAA) and converts them to normalized RGB/RGBA values. ๐ŸŽจ
  2. Theme Mapping: Uses theme keys to match colors directly or falls back to nearest-color matching with Euclidean distance and HSL adjustments. ๐Ÿ“
  3. CSS Processing: Resolves variables and simplifies functions in CSS, ensuring clean and maintainable output. ๐Ÿง‘โ€๐Ÿ’ป
  4. Output Generation: Creates new theme directories with remapped CSS files ready for IDA Pro. ๐Ÿ“ค

IDA supports some SASS directives

  • @def
  • @lighten
  • @darken
  • @importtheme
  • @ifdef/@ifndef -> optional @else -> @endif

Convert a Single Theme ๐ŸŽฏ

To convert a specific VS Code theme to IDA Pro:

python3 src/ida_themr.py /path/to/vscode/theme.json /path/to/output/directory

Batch Convert All Installed Themes ๐ŸŒ

To convert all themes from your VS Code extensions directory:

python3 src/ida_themr.py "*" /path/to/output/directory

Note: If the VS Code extensions directory isn't automatically detected, set the --ext-root flag or the VSCODE_DATA environment variable to point to your VS Code data directory. ๐Ÿ”

python3 src/ida_themr.py "*" /path/to/output/directory --ext-root /path/to/vscode/extensions

Applying the Theme to IDA Pro ๐Ÿ–Œ๏ธ

  1. Locate the generated theme folder in your output directory (named after the theme). ๐Ÿ“
  2. Copy the theme.css file from the folder to your IDA Pro themes directory (usually found in IDA's installation directory under themes/). ๐Ÿ“‹
  3. Restart IDA Pro, and select the new theme from the options menu under View > Themes. ๐ŸŽ‰

Examples ๐Ÿ“ธ

Before Conversion ๐Ÿ“

Here's a sample CSS snippet with variables and functions from a VS Code theme:

@def color-primary #ff5733;
@def color-background @lighten(#ff5733, 20);

.button {
  color: ${color-primary};
  background-color: ${color-background};
}

After Conversion ๐ŸŽจ

After processing with ida-themr, the CSS is simplified and colors are remapped for IDA Pro:

.button {
  color: #ff5733;
  background-color: #ff5733; /* simplified */
}

Testing ๐Ÿงช

ida-themr is thoroughly tested to ensure reliability. The test suite covers color conversion, JSONC parsing, HSL adjustments, variable expansion, and more. To run the tests:

python3 tests.py

You'll see detailed output confirming the functionality of each component. โœ…

Contributing ๐Ÿค

We welcome contributions to ida-themr! Whether it's bug fixes, new features, or documentation improvements, your help is appreciated. Here's how to contribute:

  1. Fork the Repository and clone it locally. ๐Ÿด
  2. Make Your Changes in a new branch. ๐ŸŒฟ
  3. Run Tests to ensure everything works (python3 tests.py). ๐Ÿงช
  4. Submit a Pull Request with a clear description of your changes. ๐Ÿ“ฌ

Please follow the coding style and include tests for new functionality. Let's make ida-themr even better together! ๐Ÿ’ช

License ๐Ÿ“œ

This project is licensed under the MIT License - see the LICENSE file for details. ๐Ÿ“„

Contact ๐Ÿ“ง

Have questions, suggestions, or need support? Open an issue on GitHub or reach out to mahmoudimus. I'm happy to help! ๐Ÿ˜Š

Acknowledgments ๐Ÿ™

@SmugNugg for the idea about resolving inlined css functions. @can1357 for his IdaThemer from which this is shamelessly ported and enhanced.

Happy theming with ida-themr! Let's make IDA Pro as colorful as your imagination! ๐ŸŽจ๐Ÿš€

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

ida_themr-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

ida_themr-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file ida_themr-0.1.0.tar.gz.

File metadata

  • Download URL: ida_themr-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ida_themr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7653c09e3b16e9a303b5298898339050873ce79441eb8e76f75a3351786193a8
MD5 c2a18fe4805ac75732d0cb14e7da7da2
BLAKE2b-256 958f3b6be78e7eb011ef87cb149fb7bfa737e94d10c832126b231de6d898488e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ida_themr-0.1.0.tar.gz:

Publisher: release.yml on mahmoudimus/ida-themr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ida_themr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ida_themr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ida_themr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d95752058ddd06a3769c4a310b59390286f3f05a04426d6d230c8291dab4dc72
MD5 1485ca52269ac4f6ce281c62e946c1a1
BLAKE2b-256 e6ba719d678e79aa1a1bd6f25cac38f97b25f438c71fc981ad33b319d668302f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ida_themr-0.1.0-py3-none-any.whl:

Publisher: release.yml on mahmoudimus/ida-themr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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