From b1ed3c26c008a89208ca7d46d9249ef33a77f610 Mon Sep 17 00:00:00 2001 From: Vyn Date: Fri, 9 Aug 2024 21:12:35 +0200 Subject: [PATCH] Change default theme to OneDark like --- CMakeLists.txt | 5 +++ src/main.cpp | 2 +- src/qml/AppButton.qml | 4 +- src/qml/AppCheckbox.qml | 6 +-- src/qml/AppComboBox.qml | 2 +- src/qml/AppIcon.qml | 2 +- src/qml/AppLineEdit.qml | 6 +-- src/qml/AppText.qml | 2 +- src/qml/DateField.qml | 2 +- src/qml/Main.qml | 9 ++++- src/qml/MainPanel.qml | 2 +- src/qml/SideMenu.qml | 6 +-- src/qml/TaskItem.qml | 9 ++--- src/qml/components/Calendar.qml | 2 +- src/qml/components/TabSelector.qml | 2 +- src/qml/forms/FilesForm.qml | 2 +- src/qml/styles/MiraiColorPalette.qml | 2 +- src/qml/styles/OneDark.qml | 55 ++++++++++++++++++++++++++++ src/qml/views/ListView.qml | 2 +- 19 files changed, 94 insertions(+), 28 deletions(-) create mode 100644 src/qml/styles/OneDark.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index c80ac3c..925b4f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,10 @@ set_source_files_properties(src/qml/styles/CatppuccinFrappe.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE ) +set_source_files_properties(src/qml/styles/OneDark.qml PROPERTIES + QT_QML_SINGLETON_TYPE TRUE +) + set_source_files_properties(src/qml/styles/MiraiColorPalette.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE ) @@ -70,6 +74,7 @@ qt_add_qml_module(mirai src/qml/components/Modal.qml src/qml/styles/MiraiColorPalette.qml src/qml/styles/CatppuccinFrappe.qml + src/qml/styles/OneDark.qml src/qml/views/ListView.qml src/qml/views/CalendarView.qml SOURCES diff --git a/src/main.cpp b/src/main.cpp index 2f82038..eaae5ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) auto m_ratioFont = qMin(height * refDpi / (dpi * refHeight), width * refDpi / (dpi * refWidth)); - QFont font("Helvetica", m_ratioFont); + QFont font("Helvetica"); app.setFont(font); QQmlApplicationEngine engine; diff --git a/src/qml/AppButton.qml b/src/qml/AppButton.qml index 792679c..7db6958 100644 --- a/src/qml/AppButton.qml +++ b/src/qml/AppButton.qml @@ -13,7 +13,7 @@ Button { id: control property bool noBackgroundColor: false - icon.color: MiraiColorPalette.buttonIcon + icon.color: colorPalette.selected.buttonIcon // I have a different behavior when setting padding for Android padding: root.isPhone ? undefined : 8 @@ -26,7 +26,7 @@ Button { icon: control.icon text: control.text font: control.font - color: MiraiColorPalette.text + color: colorPalette.selected.text } background: Rectangle { diff --git a/src/qml/AppCheckbox.qml b/src/qml/AppCheckbox.qml index 2ab26a3..92544a1 100644 --- a/src/qml/AppCheckbox.qml +++ b/src/qml/AppCheckbox.qml @@ -15,7 +15,7 @@ CheckBox { contentItem: Text { id: text text: control.text - color: MiraiColorPalette.text + color: colorPalette.selected.text verticalAlignment: Text.AlignVCenter leftPadding: control.indicator.width + control.spacing } @@ -26,7 +26,7 @@ CheckBox { implicitWidth: 12 implicitHeight: 12 radius: 999 - color: control.checked ? colorPalette.selected.palette.green : colorPalette.selected.text + color: control.checked ? colorPalette.selected.green : colorPalette.selected.text Rectangle { @@ -35,7 +35,7 @@ CheckBox { implicitWidth: 10 implicitHeight: 10 radius: 999 - color: control.checked ? colorPalette.selected.palette.green : colorPalette.selected.fieldBackground + color: control.checked ? colorPalette.selected.green : colorPalette.selected.fieldBackground } } } diff --git a/src/qml/AppComboBox.qml b/src/qml/AppComboBox.qml index ca321d6..9473948 100644 --- a/src/qml/AppComboBox.qml +++ b/src/qml/AppComboBox.qml @@ -21,7 +21,7 @@ ComboBox { background: Rectangle { implicitWidth: 200 implicitHeight: 32 - color: MiraiColorPalette.fieldBackground + color: colorPalette.selected.fieldBackground radius: 4 } } diff --git a/src/qml/AppIcon.qml b/src/qml/AppIcon.qml index 2ee0afe..85487ce 100644 --- a/src/qml/AppIcon.qml +++ b/src/qml/AppIcon.qml @@ -9,7 +9,7 @@ import QtQuick.Controls import Mirai Button { - icon.color: MiraiColorPalette.buttonIcon + icon.color: colorPalette.selected.buttonIcon background: Rectangle { color: "transparent" diff --git a/src/qml/AppLineEdit.qml b/src/qml/AppLineEdit.qml index 851be0f..b23da45 100644 --- a/src/qml/AppLineEdit.qml +++ b/src/qml/AppLineEdit.qml @@ -10,13 +10,13 @@ import QtQuick.Controls import Mirai TextField { - color: MiraiColorPalette.text - placeholderTextColor: MiraiColorPalette.textPlaceholder + color: colorPalette.selected.text + placeholderTextColor: colorPalette.selected.textPlaceholder leftPadding: 10 implicitHeight: 32 background: Rectangle { - color: MiraiColorPalette.fieldBackground + color: colorPalette.selected.fieldBackground radius: 4 } } diff --git a/src/qml/AppText.qml b/src/qml/AppText.qml index 5bf4d21..71a601e 100644 --- a/src/qml/AppText.qml +++ b/src/qml/AppText.qml @@ -9,5 +9,5 @@ import QtQuick.Controls import Mirai Text { - color: MiraiColorPalette.text + color: colorPalette.selected.text } diff --git a/src/qml/DateField.qml b/src/qml/DateField.qml index 965fa3d..c4f1976 100644 --- a/src/qml/DateField.qml +++ b/src/qml/DateField.qml @@ -15,7 +15,7 @@ Rectangle { id: datePickerRoot property alias text: newTodoDate.text property alias textFieldComponent: newTodoDate - color: MiraiColorPalette.fieldBackground + color: colorPalette.selected.fieldBackground radius: 4 implicitHeight: 32 diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 89b3478..a8fc928 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -26,7 +26,12 @@ Window { Item { id: colorPalette - property QtObject selected: MiraiColorPalette + property QtObject selected: OneDark + + function selectStyle(styleName) { + // TODO + selected = OneDark; + } } function capitalize(str) { @@ -50,6 +55,8 @@ Window { taskFormPopup.open() } + + Component { id: sideMenuComponent SideMenu { diff --git a/src/qml/MainPanel.qml b/src/qml/MainPanel.qml index b13c7c4..a5c3156 100644 --- a/src/qml/MainPanel.qml +++ b/src/qml/MainPanel.qml @@ -47,7 +47,7 @@ Rectangle { AppButton { icon.source: "qrc:/qt/qml/Mirai/src/images/add.png" - icon.color: colorPalette.selected.palette.green + icon.color: colorPalette.selected.green text: "Add task" onClicked: { root.newTask() diff --git a/src/qml/SideMenu.qml b/src/qml/SideMenu.qml index 0294b8f..71b6bcc 100644 --- a/src/qml/SideMenu.qml +++ b/src/qml/SideMenu.qml @@ -12,7 +12,7 @@ import Mirai Rectangle { - color: MiraiColorPalette.pane + color: colorPalette.selected.pane implicitWidth: childrenRect.width + 20 + 30 ColumnLayout { @@ -44,7 +44,7 @@ Rectangle { Rectangle { Layout.preferredHeight: childrenRect.height Layout.fillWidth: true - color: backend.activeResourcesFilter.includes(modelData.name) ? MiraiColorPalette.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent" + color: backend.activeResourcesFilter.includes(modelData.name) ? colorPalette.selected.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent" radius: 4 AppText { text: modelData.name @@ -94,7 +94,7 @@ Rectangle { Rectangle { Layout.preferredHeight: childrenRect.height Layout.fillWidth: true - color: backend.activeTagsFilter.includes(modelData.name) ? MiraiColorPalette.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent" + color: backend.activeTagsFilter.includes(modelData.name) ? colorPalette.selected.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent" radius: 4 QtObject { id: internal diff --git a/src/qml/TaskItem.qml b/src/qml/TaskItem.qml index a077312..799935c 100644 --- a/src/qml/TaskItem.qml +++ b/src/qml/TaskItem.qml @@ -15,7 +15,7 @@ RowLayout { function getFormatedText() { if (task?.time && task.time != "") { - return `${task.time} \> ${task.text}` + return `${task.time} \> ${task.text}` } return task.text } @@ -24,7 +24,8 @@ RowLayout { id: checkbox text: control.getFormatedText() checked: task.state === 'DONE' - textComponent.color: task.date < internal.todayDate ? colorPalette.selected.palette.pink + textComponent.font.pointSize: 14 + textComponent.color: task.date < internal.todayDate ? colorPalette.selected.red // : task.date === internal.todayDate ? colorPalette.selected.palette.sapphire : colorPalette.selected.text onClicked: { @@ -38,9 +39,7 @@ RowLayout { Layout.alignment: Qt.AlignVCenter text: modelData backgroundColor: colorPalette.selected.fieldBackground - textColor: colorPalette.selected.palette.sapphire + textColor: colorPalette.selected.accent } } - - } diff --git a/src/qml/components/Calendar.qml b/src/qml/components/Calendar.qml index 695c96a..9d158cb 100644 --- a/src/qml/components/Calendar.qml +++ b/src/qml/components/Calendar.qml @@ -139,7 +139,7 @@ ColumnLayout { property string name: modelData.text property int startTime: parseInt(modelData.startTime) property int endTime: parseInt(modelData.endTime) - color: colorPalette.selected.palette.surface0 + color: colorPalette.selected.calendarEvent anchors.right: parent.right anchors.left: parent.left anchors.rightMargin: 2 diff --git a/src/qml/components/TabSelector.qml b/src/qml/components/TabSelector.qml index a8582f0..0a18167 100644 --- a/src/qml/components/TabSelector.qml +++ b/src/qml/components/TabSelector.qml @@ -32,7 +32,7 @@ RowLayout { Rectangle { Layout.fillWidth: true - color: modelData.selected ? "white" : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent" + color: modelData.selected ? "white" : mouse.hovered ? colorPalette.selected.filterHovered : "transparent" implicitHeight: 2 } } diff --git a/src/qml/forms/FilesForm.qml b/src/qml/forms/FilesForm.qml index 6ee5624..9249727 100644 --- a/src/qml/forms/FilesForm.qml +++ b/src/qml/forms/FilesForm.qml @@ -52,7 +52,7 @@ ColumnLayout { AppButton { text: "Add" icon.source: "qrc:/qt/qml/Mirai/src/images/add.png" - icon.color: colorPalette.selected.palette.green + icon.color: colorPalette.selected.green onClicked: { fileDialog.open() } diff --git a/src/qml/styles/MiraiColorPalette.qml b/src/qml/styles/MiraiColorPalette.qml index 39e77a5..8498cfc 100644 --- a/src/qml/styles/MiraiColorPalette.qml +++ b/src/qml/styles/MiraiColorPalette.qml @@ -9,7 +9,7 @@ import QtQuick 2.5 import Mirai QtObject { - property QtObject palette: CatppuccinFrappe + property QtObject palette: OneDark property string background: CatppuccinFrappe.base property string pane: CatppuccinFrappe.mantle property string text: CatppuccinFrappe.text diff --git a/src/qml/styles/OneDark.qml b/src/qml/styles/OneDark.qml new file mode 100644 index 0000000..ea582c1 --- /dev/null +++ b/src/qml/styles/OneDark.qml @@ -0,0 +1,55 @@ +/* + * Mirai. Copyright (C) 2024 Vyn + * This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only) + * The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt + */ + +pragma Singleton +import QtQuick 2.5 + +//black = "#181a1f", +//bg0 = "#282c34", +//bg1 = "#31353f", +//bg2 = "#393f4a", +//bg3 = "#3b3f4c", +//bg_d = "#21252b", +//bg_blue = "#73b8f1", +//bg_yellow = "#ebd09c", +//fg = "#abb2bf", +//purple = "#c678dd", +//green = "#98c379", +//orange = "#d19a66", +//blue = "#61afef", +//yellow = "#e5c07b", +//cyan = "#56b6c2", +//red = "#e86671", +//grey = "#5c6370", +//light_grey = "#848b98", +//dark_cyan = "#2b6f77", +//dark_red = "#993939", +//dark_yellow = "#93691d", +//dark_purple = "#8a3fa0", +//diff_add = "#31392b", +//diff_delete = "#382b2c", +//diff_change = "#1c3448", +//diff_text = "#2c5372", + +QtObject { + property string background: "#282c34" + property string pane: "#21252b" + property string text: "#abb2bf" + property string textPlaceholder: "#5c6370" + property string accent: "#2b6f77" + property string fieldBackground: "#393f4a" + property string buttonIcon: "#2b6f77" + property string buttonBackground: "#31353f" + property string buttonHovered: "#3b3f4c" + property string filterHovered: "#5c6370" + property string filterSelected: "#3b3f4c" + property string modalBorder: "#8a3fa0" + property string calendarLines: "#3b3f4c" + property string calendarCurrentTime: "#e86671" + property string calendarEvent: "#3b3f4c" + property string green: "#98c379" + property string red: "#e86671" +} diff --git a/src/qml/views/ListView.qml b/src/qml/views/ListView.qml index 1e27333..3425cfc 100644 --- a/src/qml/views/ListView.qml +++ b/src/qml/views/ListView.qml @@ -53,7 +53,7 @@ ScrollView { text: task.modelData.date === internal.todayDate ? "Today" : task.modelData.date === internal.tomorrowDate ? "Tomorrow" : task.modelData.date - color: task.modelData.date < internal.todayDate ? colorPalette.selected.palette.pink + color: task.modelData.date < internal.todayDate ? colorPalette.selected.red // : task.modelData.date === internal.todayDate ? colorPalette.selected.palette.sapphire : colorPalette.selected.text font.pointSize: 24