mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
37 lines
850 B
QML
37 lines
850 B
QML
import QtQuick
|
|
import Qt.labs.platform
|
|
import Quickshell
|
|
import qs.Common
|
|
import qs.Services
|
|
|
|
Item {
|
|
id: colorPickerModal
|
|
|
|
signal colorSelected(color selectedColor)
|
|
|
|
function show() {
|
|
colorDialog.open()
|
|
}
|
|
|
|
function hide() {
|
|
colorDialog.close()
|
|
}
|
|
|
|
function copyColorToClipboard(colorValue) {
|
|
Quickshell.execDetached(["sh", "-c", `echo "${colorValue}" | wl-copy`])
|
|
ToastService.showInfo(`Color ${colorValue} copied to clipboard`)
|
|
console.log("Copied color to clipboard:", colorValue)
|
|
}
|
|
|
|
ColorDialog {
|
|
id: colorDialog
|
|
title: "Color Picker - Select and copy color"
|
|
color: Theme.primary
|
|
|
|
onAccepted: {
|
|
const colorString = color.toString()
|
|
copyColorToClipboard(colorString)
|
|
colorSelected(color)
|
|
}
|
|
}
|
|
} |