Dekko
Loading...
Searching...
No Matches
ColorPickerDialog.qml
1/* Copyright (C) 2025 CIT-Services <info@cit-services.eu>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import Lomiri.Components 1.3
20import Lomiri.Components.Popups 1.3
22Dialog {
23 id: colorDialog
24
25 property bool isHighlight: false
26
27 signal colorSelected(string color)
28
29 title: qsTr("Choose Color")
30
31 // Predefined color palette
32 Grid {
33 columns: 5
34 spacing: units.gu(1)
35
36 Repeater {
37 model: [
38 "#000000", "#333333", "#666666", "#999999", "#CCCCCC", "#FFFFFF",
39 "#FF0000", "#FF6600", "#FFCC00", "#00FF00", "#0000FF", "#6600FF",
40 "#CC0000", "#CC6600", "#CCCC00", "#00CC00", "#0000CC", "#6600CC",
41 "#990000", "#996600", "#999900", "#009900", "#000099", "#660099", '#ce9be7'
42 ]
43
44 Rectangle {
45 width: units.gu(5)
46 height: units.gu(5)
47 color: modelData
48 border.width: units.dp(1)
49 border.color: "#999999"
50 radius: units.gu(0.5)
51
52 MouseArea {
53 anchors.fill: parent
54 onClicked: {
55 PopupUtils.close(colorDialog)
56 colorDialog.colorSelected(modelData)
57 }
58 }
59 }
60 }
61 }
62
63 Button {
64 text: qsTr("Cancel")
65 onClicked: PopupUtils.close(colorDialog)
66 }
67}