# v1
from PySide6.QtGui import QColor
from PySide6.QtGui import QPalette
from PySide6.QtWidgets import QApplication


def apply_dark_palette(
    app: QApplication,
) -> None:

    palette = QPalette()

    palette.setColor(
        QPalette.ColorRole.Window,
        QColor(24, 24, 27),
    )

    palette.setColor(
        QPalette.ColorRole.WindowText,
        QColor(250, 250, 250),
    )

    palette.setColor(
        QPalette.ColorRole.Base,
        QColor(17, 17, 20),
    )

    palette.setColor(
        QPalette.ColorRole.AlternateBase,
        QColor(30, 30, 34),
    )

    palette.setColor(
        QPalette.ColorRole.Text,
        QColor(250, 250, 250),
    )

    palette.setColor(
        QPalette.ColorRole.Button,
        QColor(39, 39, 42),
    )

    palette.setColor(
        QPalette.ColorRole.ButtonText,
        QColor(250, 250, 250),
    )

    palette.setColor(
        QPalette.ColorRole.Highlight,
        QColor(59, 130, 246),
    )

    palette.setColor(
        QPalette.ColorRole.HighlightedText,
        QColor(255, 255, 255),
    )

    palette.setColor(
        QPalette.ColorRole.ToolTipBase,
        QColor(24, 24, 27),
    )

    palette.setColor(
        QPalette.ColorRole.ToolTipText,
        QColor(250, 250, 250),
    )

    app.setPalette(
        palette
    )


def apply_stylesheet(
) -> str:

    return """
QPushButton {
    border:none;
    border-radius:6px;
    padding:6px 12px;
}

QLineEdit,
QTextEdit,
QPlainTextEdit,
QComboBox,
QListWidget,
QTreeWidget,
QTableView {
    border:1px solid #3f3f46;
    border-radius:6px;
    padding:4px;
}

QTabWidget::pane {
    border:none;
}

QToolTip {
    border:1px solid #3f3f46;
}
"""