Files
Flora/qml/Theme.qml
T

77 lines
3.8 KiB
QML
Raw Normal View History

pragma Singleton
import QtQuick
QtObject {
id: theme
// true = тёмная, false = светлая. Читаем из SettingsStore.
readonly property bool isDark: {
// settingsStore — context property из main.cpp
try { return settingsStore && settingsStore.theme === "dark" } catch(e) { return false }
}
// Быстрый хелпер для QML: theme.dark ? "#xxx" : "#yyy"
// Основная палитра
readonly property color bg: isDark ? "#0f1115" : "#ffffff"
readonly property color bgAlt: isDark ? "#1a1d23" : "#f8f9fb"
readonly property color surface: isDark ? "#232730" : "#ffffff"
readonly property color surfaceHover: isDark ? "#2a303d" : "#f1f3f5"
readonly property color surfaceSelected: isDark ? "#2d3d56" : "#e7f0ff"
readonly property color surfaceSelectedHover: isDark ? "#344866" : "#d6e4ff"
readonly property color border: isDark ? "#2a303d" : "#e6e8ec"
readonly property color borderStrong: isDark ? "#353c4e" : "#d0d5dc"
readonly property color divider: isDark ? "#262b36" : "#eceef1"
// Текст
readonly property color text: isDark ? "#e6e8ee" : "#1a1d23"
readonly property color textSecondary: isDark ? "#a8b0c0" : "#505866"
readonly property color textMuted: isDark ? "#727c90" : "#868e96"
readonly property color textFaint: isDark ? "#545d71" : "#adb5bd"
readonly property color textInverse: isDark ? "#1a1d23" : "#ffffff"
// Акцент
readonly property color accent: isDark ? "#4c8ef7" : "#3b82f6"
readonly property color accentHover: isDark ? "#6aa0ff" : "#2563eb"
readonly property color accentMuted: isDark ? "#2a3d5a" : "#dbeafe"
readonly property color accentText: isDark ? "#b8d0ff" : "#1e40af"
// Специальные
readonly property color headerBg: isDark ? "#1d2028" : "#f8f9fb"
readonly property color toolbarBg: isDark ? "#232730" : "#f3f4f6"
readonly property color tabActiveBg: isDark ? "#2a303d" : "#ffffff"
readonly property color tabInactiveBg: isDark ? "#1d2028" : "#eceef1"
readonly property color editorBg: isDark ? "#1a1d23" : "#ffffff"
readonly property color editorText: isDark ? "#e6e8ee" : "#1a1d23"
readonly property color selectionBg: isDark ? "#2d3d56" : "#cfe0ff"
readonly property color codeBg: isDark ? "#252a33" : "#f8f9fb"
readonly property color blockquoteBg: isDark ? "#222832" : "#f8f9fb"
readonly property color hr: isDark ? "#2a303d" : "#e9ecef"
// Статусы
readonly property color successBg: isDark ? "#1e3320" : "#e5f6e5"
readonly property color successText: isDark ? "#7bd88f" : "#256029"
readonly property color errorBg: isDark ? "#3d1f24" : "#fdeaea"
readonly property color errorText: isDark ? "#ff8a9b" : "#9c1c1c"
readonly property color warningBg: isDark ? "#3d2f1a" : "#fff4e0"
readonly property color warningText: isDark ? "#ffb86a" : "#7a4a00"
// Граф / календарь
readonly property color graphBg: isDark ? "#1d2028" : "#eef1f5"
readonly property color graphEdge: isDark ? "#353c4e" : "#b9c6d6"
readonly property color graphNodeFile: isDark ? "#4c8ef7" : "#3f7fd0"
readonly property color graphNodeTag: isDark ? "#4ade80" : "#3aa06a"
readonly property color graphLabel: isDark ? "#868e96" : "#5a6a7d"
readonly property color calendarToday: isDark ? "#2d3d56" : "#dbeafe"
readonly property color calendarDot: isDark ? "#4c8ef7" : "#3b82f6"
readonly property color tagChipBg: isDark ? "#2a303d" : "#e8eef7"
readonly property color tagChipBgHover: isDark ? "#2d3d56" : "#dbeafe"
readonly property color tagChipBorder: isDark ? "#353c4e" : "#b7c9e0"
readonly property color tagChipText: isDark ? "#a8c0ff" : "#2b4b74"
// Тени
readonly property color shadow: isDark ? "#0a0c0f" : "#000000"
function alpha(c, a) {
return Qt.rgba(c.r, c.g, c.b, a)
}
}