Hex color converter for Dynamic Schema

This Python script provides a simple GUI to convert hexadecimal color codes to the integer color format used by App Inventor. The script is built using Tkinter for the graphical user interface, and also utilizes the pyperclip library to copy the result to the clipboard.

Required Python Libraries

This script relies on the following Python libraries:

  • Tkinter: A standard Python library for creating lightweight and simple GUIs. This is included with most Python installations, but if it’s not present, you can usually add it via your distribution’s package manager.

  • pyperclip: A Python library for cross-platform clipboard code. It handles copying the output color integer to your clipboard for easy pasting. Install it using pip:

    pip install pyperclip
    

Usage

  1. Run the script. It opens a small window with an input field and a “Convert” button.
  2. Enter a hexadecimal color code into the field. The color code can optionally include the preceding “#”. If the color code does not include an alpha channel, it will be assumed to be “FF”.
  3. Press Enter or click “Convert”. The equivalent App Inventor color integer will be copied to your clipboard and also displayed in a message box.
  4. The message box will automatically dismiss after 5 seconds.
  5. Clicking inside the input field will clear its content, ready for a new conversion.

Script

color_converter.zip (951 Bytes)

Use Dynamic schema

1 Like

You can also use the new TemplateCreator tool is still in beta I guess:

1 Like