#  SPDX-FileCopyrightText: 2026 Damon Lynch <damonlynch@gmail.com>
#  SPDX-License-Identifier: GPL-3.0-or-later

import sys

from PyQt5.QtGui import QPalette
from PyQt5.QtWidgets import QApplication


def make_camel_case(text: str) -> str:
    return "".join(["_" + c.lower() if c.isupper() else c for c in text]).lstrip("_")


def dump_palette():
    app = QApplication(sys.argv)
    palette = app.palette()

    # Define groups and roles to iterate through
    groups = {
        "Active": QPalette.Active,
        "Inactive": QPalette.Inactive,
        "Disabled": QPalette.Disabled,
    }

    # Common roles to check
    roles = {
        "Window": QPalette.Window,
        "WindowText": QPalette.WindowText,
        "Base": QPalette.Base,
        "AlternateBase": QPalette.AlternateBase,
        "ToolTipBase": QPalette.ToolTipBase,
        "ToolTipText": QPalette.ToolTipText,
        "Text": QPalette.Text,
        "Button": QPalette.Button,
        "ButtonText": QPalette.ButtonText,
        "BrightText": QPalette.BrightText,
        "Highlight": QPalette.Highlight,
        "HighlightedText": QPalette.HighlightedText,
        "Link": QPalette.Link,
        "LinkVisited": QPalette.LinkVisited,
        "Light": QPalette.Light,
        "Midlight": QPalette.Midlight,
        "Dark": QPalette.Dark,
        "Mid": QPalette.Mid,
        "Shadow": QPalette.Shadow,
        "PlaceholderText": QPalette.PlaceholderText,
    }

    for group_name, group in groups.items():
        for role_name, role in roles.items():
            color = palette.color(group, role)
            print(
                f"palette.setColor(QPalette.{group_name}, QPalette.{role_name}, QColor('{color.name()}'))"
            )


if __name__ == "__main__":
    dump_palette()
