### Set Stylesheet and Run Application Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Applies a VS Code-like stylesheet to the application and starts the Qt event loop. Ensure qtvsc and necessary Qt modules are imported. ```python app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS)) win = QMainWindow() win.setWindowTitle("QtVSCodeStyle Demo") win.resize(800, 600) win.show() sys.exit(app.exec()) ``` -------------------------------- ### Custom Colors JSON Example Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Example JSON file for defining custom colors for the QtVSCodeStyle theme. ```JSON // custom.json { "focusBorder": "#ff0000", "foreground": "#ff00ff" } ``` -------------------------------- ### Load and Apply VS Code Dark Theme Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Applies the default VS Code Dark theme to a PySide6 application. Ensure PySide6 is installed and the qtvscodestyle library is imported. ```Python import sys from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton import qtvscodestyle as qtvsc app = QApplication(sys.argv) main_win = QMainWindow() push_button = QPushButton("QtVSCodeStyle!!") main_win.setCentralWidget(push_button) stylesheet = qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS) # stylesheet = load_stylesheet(qtvsc.Theme.LIGHT_VS) app.setStyleSheet(stylesheet) main_win.show() app.exec() ``` -------------------------------- ### Display Resource Builder Help Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Displays the help information for the qtvscodestyle.resource_builder command, useful for understanding available options and usage. ```Shell python -m qtvscodestyle.resource_builder --help ``` -------------------------------- ### Build Static Resource Files with Resource Builder CLI Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Use the `qtvscodestyle.resource_builder` CLI to generate static `stylesheet.qss` and `resource.qrc` files. This is useful for deployment contexts where dynamic files are not desired. Custom color overrides are supported via JSON. ```bash # Build resources for the Dark VS theme (output: ./qtvscodestyle_resources/) python -m qtvscodestyle.resource_builder --theme dark_vs # Build for Monokai with custom color overrides from a JSON file python -m qtvscodestyle.resource_builder -t monokai --custom-colors-path custom.json # custom.json example: # { # "focusBorder": "#ff0000", # "foreground": "#ff00ff", # "button.background": "#005f87" # } # Full list of options python -m qtvscodestyle.resource_builder --help # Output structure: # qtvscodestyle_resources/ # ├─ stylesheet.qss <- paste into Qt Designer stylesheet property # ├─ resource.qrc <- register in Qt Designer's resource browser # └─ svg/ # ├─ arrow-down_foreground_0.svg # ├─ check_foreground_0.svg # └─ ... # Qt Designer integration steps: # 1. Run the builder command above # 2. Copy the text from stylesheet.qss # 3. Paste into the stylesheet property of the top-level widget in Qt Designer # 4. Register resource.qrc in the resource browser ``` -------------------------------- ### List Available VS Code Themes Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Prints a list of all available VS Code themes that can be loaded by the qtvscodestyle library, along with their corresponding symbols. ```Python qtvsc.list_themes() ``` -------------------------------- ### Check Common Widgets Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Run a gallery application to visualize how common Qt widgets are rendered with the applied VS Code styling. ```Plaintext python -m qtvscodestyle.examples.widget_gallery ``` -------------------------------- ### Create Themed QIcon with theme_icon() Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Generate a QIcon that automatically adapts its color based on the currently loaded stylesheet. Use this for icons that should respect the theme's color scheme. ```Python star_icon = qtvsc.theme_icon(qtvsc.Vsc.STAR_FULL, "icon.foreground") button = QToolButton() button.setIcon(star_icon) # star_icon switch to the MONOKAI's "icon.foreground" color. qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI) ``` -------------------------------- ### Load Third-Party Theme Stylesheet Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Load a third-party theme file (e.g., One Dark Pro) into your Qt application. Ensure the theme file is downloaded and accessible. ```Python theme_file = r"OneDark-Pro.json" stylesheet = qtvsc.load_stylesheet(theme_file) app.setStyleSheet(stylesheet) ``` -------------------------------- ### Use Font Awesome Icons with qtvscodestyle Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Utilize Font Awesome Free icons from FaSolid, FaRegular, and FaBrands enums for various styles. Use theme_icon for theme-aware icons. The value attribute provides the Unicode code point. ```python import qtvscodestyle as qtvsc # FaSolid — filled/solid style home_icon = qtvsc.icon(qtvsc.FaSolid.HOME, "#FFFFFF") trash_icon = qtvsc.icon(qtvsc.FaSolid.TRASH, "#FF4444") cog_icon = qtvsc.theme_icon(qtvsc.FaSolid.COG, "icon.foreground") # FaRegular — outline/regular style bell_icon = qtvsc.icon(qtvsc.FaRegular.BELL, "#FFCC00") heart_icon = qtvsc.icon(qtvsc.FaRegular.HEART, "#FF69B4") # FaBrands — brand/logo style github_icon = qtvsc.icon(qtvsc.FaBrands.GITHUB, "#FFFFFF") python_icon = qtvsc.icon(qtvsc.FaBrands.PYTHON, "#3572A5") docker_icon = qtvsc.theme_icon(qtvsc.FaBrands.DOCKER, "icon.foreground") print(qtvsc.FaSolid.HOME.value) # 0xF015 print(qtvsc.FaRegular.BELL.value) # 0xF0F3 print(qtvsc.FaBrands.GITHUB.value) # 0xF09B ``` -------------------------------- ### Launch Icon Browser Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Open an interactive browser to view and select available icons from Font Awesome and VS Code Codicons. ```Plaintext python -m qtvscodestyle.examples.icon_browser ``` -------------------------------- ### Build Theme Resources with Custom Colors Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Builds style sheets with resources for a specified theme, applying custom colors defined in a JSON file. Ensure resource files and SVG folders are in the same directory. Not supported on PyQt6. ```Shell python -m qtvscodestyle.resource_builder -t dark_vs --custom-colors-path custom.json ``` -------------------------------- ### Build Dark VS Code Theme Resources Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Builds style sheets with resources for the dark VS Code theme. Ensure resource files and SVG folders are in the same directory. Not supported on PyQt6. ```Shell python -m qtvscodestyle.resource_builder --theme dark_vs ``` -------------------------------- ### List All Available Themes Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Prints a formatted table of all built-in theme display names and their corresponding Theme enum symbol names. Useful for discovering valid symbols to pass to load_stylesheet(). ```python import qtvscodestyle as qtvsc qtvsc.list_themes() # Theme name Symbol # ___________ ______ # # Light (Visual Studio): LIGHT_VS # Quiet Light : QUIET_LIGHT # Solarized Light : SOLARIZED_LIGHT # Abyss : ABYSS # Dark (Visual Studio) : DARK_VS # Kimbie Dark : KIMBIE_DARK # Monokai : MONOKAI # Monokai Dimmed : MONOKAI_DIMMED # Red : RED # Solarized Dark : SOLARIZED_DARK # Tomorrow Night Blue : TOMORROW_NIGHT_BLUE # Dark High Contrast : DARK_HIGH_CONTRAST ``` -------------------------------- ### list_themes() Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Prints a formatted table of all built-in theme display names and their corresponding Theme enum symbol names to stdout. Useful for discovering valid symbols to pass to load_stylesheet(). ```APIDOC ## `list_themes()` — Print all available built-in theme names and symbols Prints a formatted table of all built-in theme display names and their corresponding `Theme` enum symbol names to stdout. Useful for discovering valid symbols to pass to `load_stylesheet()`. ```python import qtvscodestyle as qtvsc qtvsc.list_themes() # Theme name Symbol # ___________ ______ # # Light (Visual Studio): LIGHT_VS # Quiet Light : QUIET_LIGHT # Solarized Light : SOLARIZED_LIGHT # Abyss : ABYSS # Dark (Visual Studio) : DARK_VS # Kimbie Dark : KIMBIE_DARK # Monokai : MONOKAI # Monokai Dimmed : MONOKAI_DIMMED # Red : RED # Solarized Dark : SOLARIZED_DARK # Tomorrow Night Blue : TOMORROW_NIGHT_BLUE # Dark High Contrast : DARK_HIGH_CONTRAST ``` ``` -------------------------------- ### Load Custom Theme from JSON File Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Apply a custom theme by providing the path to a JSON file. This method supports JSON files with comments and can also accept `pathlib.Path` objects. ```Python custom_theme_path = r"custom_theme.json" # or you can use pathlib.Path object # custom_theme_path = pathlib.Path("custom_theme.json") stylesheet = qtvsc.load_stylesheet(custom_theme_path) ``` -------------------------------- ### Load Qt Stylesheet from VS Code Theme Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Applies a VS Code theme as a Qt stylesheet. Supports built-in themes, theme files, custom color overrides, and theme dictionaries. Icon SVGs are managed in a temporary directory. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget app = QApplication(sys.argv) # --- Built-in theme --- stylesheet = qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS) app.setStyleSheet(stylesheet) # --- Built-in theme with color overrides --- custom_colors = { "button.background": "#005f87", "button.foreground": "#ffffff", "focusBorder": "#ff0000", } sheet = qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI, custom_colors) app.setStyleSheet(stylesheet) # --- Third-party extension theme (file path) --- # Download OneDark-Pro.json from https://github.com/Binaryify/OneDark-Pro sheet = qtvsc.load_stylesheet("OneDark-Pro.json") app.setStyleSheet(stylesheet) # --- Custom theme dictionary --- custom_theme = { "type": "dark", # "dark", "light", or "hc" (high contrast) "colors": { "button.background": "#1e1e1e", "foreground": "#d4d4d4", "selection.background": "#404040", "focusBorder": "#007acc", }, } sheet = qtvsc.load_stylesheet(custom_theme) app.setStyleSheet(stylesheet) main_win = QMainWindow() btn = QPushButton("Hello QtVSCodeStyle") main_win.setCentralWidget(btn) main_win.show() sys.exit(app.exec()) ``` -------------------------------- ### Create Custom Dark Theme from Dictionary Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Define a custom theme's type and colors using a Python dictionary. This method is suitable for dynamic theme creation. ```Python custom_theme = { "type": "dark", # dark or light or hc(high contrast) "colors": { "button.background": "#1e1e1e", "foreground": "#d4d4d4", "selection.background": "#404040", }, } stylesheet = qtvsc.load_stylesheet(custom_theme) ``` -------------------------------- ### loads_stylesheet Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Parses a JSONC (JSON with comments) string representing a VS Code theme and returns a Qt stylesheet. This is useful for themes embedded in source code or fetched from a network. Comments and trailing commas are automatically handled. ```APIDOC ## `loads_stylesheet(theme_text, custom_colors)` — Load a theme from a JSON-with-comments string Parses a JSONC (JSON with comments) string representing a VS Code theme and returns a Qt stylesheet. Useful when theme content is embedded in source code or fetched from a network. Comments (`//` and `/* */`) and trailing commas are stripped before parsing. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QPushButton app = QApplication(sys.argv) theme_text = """ { // Custom dark theme "type": "dark", "colors": { "button.background": "#2d2d2d", // Dark button "button.foreground": "#cccccc", "foreground": "#d4d4d4", "selection.background": "#264f78", /* Focus ring */ "focusBorder": "#007fd4", } } """ sheet = qtvsc.loads_stylesheet(theme_text) app.setStyleSheet(stylesheet) btn = QPushButton("Styled Button") btn.show() sys.exit(app.exec()) ``` ``` -------------------------------- ### Create QIcon with Static Color Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Create a QIcon with a specific, static color that will not change even if the stylesheet is updated. Use this for icons that require a fixed color. ```Python # Set red star_icon = qtvsc.icon(qtvsc.Vsc.STAR_FULL, "#FF0000") button = QToolButton() button.setIcon(star_icon) # Keep red. qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI) ``` -------------------------------- ### Create Custom Theme from JSON String Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Load a custom theme defined as a JSON string, including comments. Use `loads_stylesheet` for string-based theme definitions. ```Python custom_theme = """ { "type": "dark", "colors": { "button.background": "#1e1e1e", "foreground": "#d4d4d4", "selection.background": "#404040" } } """ # You need to use loads_stylesheet stylesheet = qtvsc.loads_stylesheet(custom_theme) ``` -------------------------------- ### Load Stylesheet from JSONC String Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Parses a JSONC (JSON with comments) string to generate a Qt stylesheet. Useful for embedded or fetched theme data. Comments and trailing commas are automatically handled. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QPushButton app = QApplication(sys.argv) theme_text = """ { // Custom dark theme "type": "dark", "colors": { "button.background": "#2d2d2d", // Dark button "button.foreground": "#cccccc", "foreground": "#d4d4d4", "selection.background": "#264f78", /* Focus ring */ "focusBorder": "#007fd4", } } """ sheet = qtvsc.loads_stylesheet(theme_text) app.setStyleSheet(stylesheet) btn = QPushButton("Styled Button") btn.show() sys.exit(app.exec()) ``` -------------------------------- ### List Available Color IDs Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Retrieve a list of all customizable color IDs supported by QtVSCodeStyle. This is useful for identifying specific elements to style. ```Python qtvsc.list_color_id() ``` -------------------------------- ### load_stylesheet Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Applies a VS Code theme as a Qt stylesheet. This function can accept a built-in Theme enum, a path to a VS Code theme JSON file, or a theme dictionary. It also supports overriding specific color tokens with the `custom_colors` argument. ```APIDOC ## `load_stylesheet(theme, custom_colors)` — Apply a VS Code theme as a Qt stylesheet Generates and returns a Qt stylesheet string from a built-in `Theme` enum value, a path to a VS Code `.json` theme file, or a theme dictionary. Optionally accepts `custom_colors` to override specific color tokens using the same format as VS Code's `workbench.colorCustomizations`. The returned string is passed directly to `QApplication.setStyleSheet()`. Icon SVG files are written to a managed temporary directory that persists for the lifetime of the application. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget app = QApplication(sys.argv) # --- Built-in theme --- stylesheet = qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS) app.setStyleSheet(stylesheet) # --- Built-in theme with color overrides --- custom_colors = { "button.background": "#005f87", "button.foreground": "#ffffff", "focusBorder": "#ff0000", } sheet = qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI, custom_colors) app.setStyleSheet(stylesheet) # --- Third-party extension theme (file path) --- # Download OneDark-Pro.json from https://github.com/Binaryify/OneDark-Pro sheet = qtvsc.load_stylesheet("OneDark-Pro.json") app.setStyleSheet(stylesheet) # --- Custom theme dictionary --- custom_theme = { "type": "dark", # "dark", "light", or "hc" (high contrast) "colors": { "button.background": "#1e1e1e", "foreground": "#d4d4d4", "selection.background": "#404040", "focusBorder": "#007acc", }, } sheet = qtvsc.load_stylesheet(custom_theme) app.setStyleSheet(stylesheet) main_win = QMainWindow() btn = QPushButton("Hello QtVSCodeStyle") main_win.setCentralWidget(btn) main_win.show() sys.exit(app.exec()) ``` ``` -------------------------------- ### Improve Qt5 High-DPI SVG Rendering Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt On Qt5, apply `AA_UseHighDpiPixmaps` before the event loop to enhance SVG icon sharpness. This attribute is not supported in PyQt6 and should be guarded. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtCore import Qt from qtvscodestyle.qtpy.QtWidgets import QApplication, QMainWindow app = QApplication(sys.argv) ``` -------------------------------- ### Create Static-Color QIcon Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Returns a QIcon rendered in a fixed hex color that does not change when the theme changes. Accepts any Vsc, FaSolid, FaRegular, or FaBrands enum member plus an RGB/RGBA hex color string. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QToolButton app = QApplication(sys.argv) # Static red warning icon warning_icon = qtvsc.icon(qtvsc.Vsc.WARNING, "#FF0000") # Static green checkmark (Font Awesome) check_icon = qtvsc.icon(qtvsc.FaSolid.CHECK_CIRCLE, "#00AA00") # Static brand icon (GitHub logo in white) github_icon = qtvsc.icon(qtvsc.FaBrands.GITHUB, "#FFFFFF") # Semi-transparent blue info icon using RGBA hex info_icon = qtvsc.icon(qtvsc.Vsc.INFO, "#0078D480") btn = QToolButton() btn.setIcon(warning_icon) btn.show() # Changing theme has no effect on static icon colors app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.LIGHT_VS)) # warning_icon remains red sys.exit(app.exec()) ``` -------------------------------- ### theme_icon(icon_id, color_id) Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Returns a QIcon whose color is automatically updated whenever load_stylesheet() is called with a different theme. The icon color tracks the given VS Code color token ID (default "icon.foreground"). Supports VS Code codicons (Vsc), Font Awesome Solid (FaSolid), Regular (FaRegular), and Brands (FaBrands) icon sets. ```APIDOC ## `theme_icon(icon_id, color_id)` — Create a theme-aware QIcon Returns a `QIcon` whose color is automatically updated whenever `load_stylesheet()` is called with a different theme. The icon color tracks the given VS Code color token ID (default `"icon.foreground"`). Supports VS Code codicons (`Vsc`), Font Awesome Solid (`FaSolid`), Regular (`FaRegular`), and Brands (`FaBrands`) icon sets. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QMainWindow, QToolBar, QToolButton app = QApplication(sys.argv) # Create a star icon that follows the current theme's icon.foreground color star_icon = qtvsc.theme_icon(qtvsc.Vsc.STAR_FULL, "icon.foreground") bug_icon = qtvsc.theme_icon(qtvsc.Vsc.BUG) # defaults to "icon.foreground" save_icon = qtvsc.theme_icon(qtvsc.FaSolid.SAVE, "icon.foreground") toolbar = QToolBar() for icon_obj, label in [(star_icon, "Star"), (bug_icon, "Bug"), (save_icon, "Save")]: btn = QToolButton() btn.setIcon(icon_obj) btn.setText(label) toolbar.addWidget(btn) win = QMainWindow() win.addToolBar(toolbar) # Apply initial theme — icons render in DARK_VS icon.foreground color app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS)) # Switching theme automatically updates all theme_icon colors app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI)) win.show() sys.exit(app.exec()) ``` ``` -------------------------------- ### Create Theme-Aware QIcon Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Returns a QIcon whose color is automatically updated whenever load_stylesheet() is called with a different theme. The icon color tracks the given VS Code color token ID (default "icon.foreground"). Supports VS Code codicons, Font Awesome Solid, Regular, and Brands icon sets. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QMainWindow, QToolBar, QToolButton app = QApplication(sys.argv) # Create a star icon that follows the current theme's icon.foreground color star_icon = qtvsc.theme_icon(qtvsc.Vsc.STAR_FULL, "icon.foreground") bug_icon = qtvsc.theme_icon(qtvsc.Vsc.BUG) # defaults to "icon.foreground" save_icon = qtvsc.theme_icon(qtvsc.FaSolid.SAVE, "icon.foreground") toolbar = QToolBar() for icon_obj, label in [(star_icon, "Star"), (bug_icon, "Bug"), (save_icon, "Save")]: btn = QToolButton() btn.setIcon(icon_obj) btn.setText(label) toolbar.addWidget(btn) win = QMainWindow() win.addToolBar(toolbar) # Apply initial theme — icons render in DARK_VS icon.foreground color app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS)) # Switching theme automatically updates all theme_icon colors app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.MONOKAI)) win.show() sys.exit(app.exec()) ``` -------------------------------- ### Customize Theme Colors Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Apply custom color overrides to a theme, similar to VS Code's workbench.colorCustomizations. Use this to fine-tune specific UI element colors. ```Python # Set the button text color to red. custom_colors = {"button.foreground": "#ff0000"} stylesheet = qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS, custom_colors) ``` -------------------------------- ### icon(icon_id, color_code) Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Returns a QIcon rendered in a fixed hex color that does not change when the theme changes. Accepts any Vsc, FaSolid, FaRegular, or FaBrands enum member plus an RGB/RGBA hex color string. ```APIDOC ## `icon(icon_id, color_code)` — Create a static-color QIcon Returns a `QIcon` rendered in a fixed hex color that does not change when the theme changes. Accepts any `Vsc`, `FaSolid`, `FaRegular`, or `FaBrands` enum member plus an RGB/RGBA hex color string. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import QApplication, QToolButton app = QApplication(sys.argv) # Static red warning icon warning_icon = qtvsc.icon(qtvsc.Vsc.WARNING, "#FF0000") # Static green checkmark (Font Awesome) check_icon = qtvsc.icon(qtvsc.FaSolid.CHECK_CIRCLE, "#00AA00") # Static brand icon (GitHub logo in white) github_icon = qtvsc.icon(qtvsc.FaBrands.GITHUB, "#FFFFFF") # Semi-transparent blue info icon using RGBA hex info_icon = qtvsc.icon(qtvsc.Vsc.INFO, "#0078D480") btn = QToolButton() btn.setIcon(warning_icon) btn.show() # Changing theme has no effect on static icon colors app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.LIGHT_VS)) # warning_icon remains red sys.exit(app.exec()) ``` ``` -------------------------------- ### List Supported Color Token IDs Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Prints a formatted table of every color token ID supported for customization via the custom_colors argument of load_stylesheet(). IDs follow the same naming convention as VS Code's workbench.colorCustomizations. ```python import qtvscodestyle as qtvsc qtvsc.list_color_id() # Color ID Description # ________ ___________ # # foreground : Overall foreground color ... # focusBorder : Color of the focus border ... # selection.background : ... # button.background : Button background color # button.foreground : Button foreground color # button.hoverBackground : ... # input.background : Input box background # input.foreground : Input box foreground # input.placeholderForeground : ... # ... (hundreds more) ``` -------------------------------- ### Improve Image Quality on Qt5 Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md This attribute can be added to improve the quality of images on Qt5 applications when using SVG, as image quality may be lower otherwise. ```Python app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps) ``` -------------------------------- ### Apply ActivityBar Style to QToolBar Source: https://github.com/5yutan5/qtvscodestyle/blob/main/README.md Sets the 'type' property of a QToolBar to 'activitybar' to apply the VS Code activity bar styling. ```Python activitybar = QToolBar() activitybar.setProperty("type", "activitybar") ``` -------------------------------- ### List and Iterate Built-in VS Code Themes Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Provides access to built-in VS Code themes via the `Theme` enum. Use `list_themes()` to display available themes and their symbols, or iterate through the enum members to access theme metadata like `name` and `type`. ```python import qtvscodestyle as qtvsc # List all available themes with their symbols qtvsc.list_themes() # Output: # Theme name Symbol # ___________ ______ # Light (Visual Studio) : LIGHT_VS # Quiet Light : QUIET_LIGHT # Solarized Light : SOLARIZED_LIGHT # Abyss : ABYSS # Dark (Visual Studio) : DARK_VS # Kimbie Dark : KIMBIE_DARK # Monokai : MONOKAI # Monokai Dimmed : MONOKAI_DIMMED # Red : RED # Solarized Dark : SOLARIZED_DARK # Tomorrow Night Blue : TOMORROW_NIGHT_BLUE # Dark High Contrast : DARK_HIGH_CONTRAST # Iterate all themes programmatically for theme in qtvsc.Theme: print(theme.name, "->", theme.value["type"]) # LIGHT_VS -> light # DARK_VS -> dark # DARK_HIGH_CONTRAST -> hc # ... ``` -------------------------------- ### Apply VS Code Widget Styles Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Apply VS Code-specific styling to Qt widgets using the 'type' or 'state' property. This enables styles like activity bars, secondary buttons, and warning/error indicators for line edits. ```python import sys import qtvscodestyle as qtvsc from qtvscodestyle.qtpy.QtWidgets import ( QApplication, QMainWindow, QToolBar, QPushButton, QLineEdit, QFrame, QVBoxLayout, QWidget ) app = QApplication(sys.argv) # QToolBar styled as VS Code's activity bar (left-side icon panel) activitybar = QToolBar() activitybar.setProperty("type", "activitybar") # QPushButton styled as a secondary (outlined) button secondary_btn = QPushButton("Secondary Action") secondary_btn.setProperty("type", "secondary") # QLineEdit with warning or error state indicator warning_edit = QLineEdit("Warning input") warning_edit.setProperty("state", "warning") error_edit = QLineEdit("Error input") error_edit.setProperty("state", "error") # QFrame styled as a horizontal or vertical separator line h_line = QFrame() h_line.setProperty("type", "h_line") v_line = QFrame() v_line.setProperty("type", "v_line") layout = QVBoxLayout() for widget in [secondary_btn, warning_edit, error_edit, h_line]: layout.addWidget(widget) container = QWidget() container.setLayout(layout) win = QMainWindow() win.addToolBar(activitybar) win.setCentralWidget(container) app.setStyleSheet(qtvsc.load_stylesheet(qtvsc.Theme.DARK_VS)) win.show() sys.exit(app.exec()) ``` -------------------------------- ### list_color_id() Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Prints a formatted table of every color token ID supported for customization via the `custom_colors` argument of `load_stylesheet()`. IDs follow the same naming convention as VS Code's `workbench.colorCustomizations`. ```APIDOC ## `list_color_id()` — Print all supported color token IDs Prints a formatted table of every color token ID supported for customization via the `custom_colors` argument of `load_stylesheet()`. IDs follow the same naming convention as VS Code's `workbench.colorCustomizations`. ```python import qtvscodestyle as qtvsc qtvsc.list_color_id() # Color ID Description # ________ ___________ # # foreground : Overall foreground color ... # focusBorder : Color of the focus border ... # selection.background : ... # button.background : Button background color # button.foreground : Button foreground color # button.hoverBackground : ... # input.background : Input box background # input.foreground : Input box foreground # input.placeholderForeground : ... # ... (hundreds more) ``` ``` -------------------------------- ### Use VS Code Icons Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Create icons using the Vsc enum for VS Code-specific icons, specifying color. An interactive icon browser is available for exploration. ```python my_icon = qtvsc.icon(qtvsc.Vsc.ROCKET, "#FFA500") ``` -------------------------------- ### Theme enum Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt An enum representing all built-in VS Code default themes. Each member provides metadata such as `name`, `file_name`, and `type` ('light', 'dark', or 'hc'). Members can be directly passed to `load_stylesheet()`. ```APIDOC ## `Theme` enum — Built-in VS Code themes Enum of all built-in VS Code default themes. Each member carries `name`, `file_name`, and `type` (`"light"`, `"dark"`, or `"hc"`) metadata. Pass a member directly to `load_stylesheet()`. ```python import qtvscodestyle as qtvsc # List all available themes with their symbols qtvsc.list_themes() # Output: # Theme name Symbol # ___________ ______ # Light (Visual Studio) : LIGHT_VS # Quiet Light : QUIET_LIGHT # Solarized Light : SOLARIZED_LIGHT # Abyss : ABYSS # Dark (Visual Studio) : DARK_VS # Kimbie Dark : KIMBIE_DARK # Monokai : MONOKAI # Monokai Dimmed : MONOKAI_DIMMED # Red : RED # Solarized Dark : SOLARIZED_DARK # Tomorrow Night Blue : TOMORROW_NIGHT_BLUE # Dark High Contrast : DARK_HIGH_CONTRAST # Iterate all themes programmatically for theme in qtvsc.Theme: print(theme.name, "->", theme.value["type"]) # LIGHT_VS -> light # DARK_VS -> dark # DARK_HIGH_CONTRAST -> hc # ... ``` ``` -------------------------------- ### Apply High-DPI Pixmap Attribute in PyQt5 Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt This code snippet conditionally applies the AA_UseHighDpiPixmaps attribute to the QApplication if it's available, which is relevant for high-DPI displays. This attribute was removed in PyQt6. ```python if hasattr(Qt.ApplicationAttribute, "AA_UseHighDpiPixmaps"): app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps) ``` -------------------------------- ### Access Theme Metadata Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Access the value of a specific theme enum member to retrieve its metadata. ```python print(qtvsc.Theme.MONOKAI.value) # {'name': 'Monokai', 'file_name': 'monokai-color-theme.json', 'type': 'dark'} ``` -------------------------------- ### Vsc enum Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Enum of all VS Code codicons SVG icons (from vscode-codicons). Each member's value is the SVG file name. Use members with theme_icon() or icon(). ```APIDOC ## `Vsc` enum — VS Code codicons icon set Enum of all VS Code codicons SVG icons (from `vscode-codicons`). Each member's value is the SVG file name. Use members with `theme_icon()` or `icon()`. ```python import qtvscodestyle as qtvsc # Browse a selection of available Vsc icons: print(qtvsc.Vsc.SEARCH) # Vsc.SEARCH print(qtvsc.Vsc.SEARCH.value) # 'search.svg' print(qtvsc.Vsc.DEBUG_START) print(qtvsc.Vsc.SETTINGS_GEAR) print(qtvsc.Vsc.SOURCE_CONTROL) print(qtvsc.Vsc.TERMINAL) print(qtvsc.Vsc.GIT_COMMIT) print(qtvsc.Vsc.CLOUD_UPLOAD) ``` ``` -------------------------------- ### VS Code Codicons Enum Source: https://context7.com/5yutan5/qtvscodestyle/llms.txt Enum of all VS Code codicons SVG icons. Each member's value is the SVG file name. Use members with theme_icon() or icon(). ```python import qtvscodestyle as qtvsc # Browse a selection of available Vsc icons: print(qtvsc.Vsc.SEARCH) # Vsc.SEARCH print(qtvsc.Vsc.SEARCH.value) # 'search.svg' print(qtvsc.Vsc.DEBUG_START) print(qtvsc.Vsc.SETTINGS_GEAR) print(qtvsc.Vsc.SOURCE_CONTROL) print(qtvsc.Vsc.TERMINAL) print(qtvsc.Vsc.GIT_COMMIT) print(qtvsc.Vsc.CLOUD_UPLOAD) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.