Parse theme from a custom simpler format
This commit is contained in:
@@ -105,7 +105,7 @@ HRectangle {
|
||||
vals.reduce((a, b) => a.length > b.length ? a: b)
|
||||
|
||||
let textNotStartsWithAnyAlias =
|
||||
! vals.some(a => text.startsWith(a))
|
||||
! vals.some(a => a.startsWith(text))
|
||||
|
||||
let textContainsCharNotInAnyAlias =
|
||||
vals.every(a => text.split("").some(c => ! a.includes(c)))
|
||||
|
@@ -53,9 +53,10 @@ Python {
|
||||
call("APP.is_debug_on", [Qt.application.arguments], on => {
|
||||
window.debug = on
|
||||
|
||||
callCoro("load_settings", [], ([settings, uiState]) => {
|
||||
callCoro("load_settings", [], ([settings, uiState, theme]) => {
|
||||
window.settings = settings
|
||||
window.uiState = uiState
|
||||
window.theme = Qt.createQmlObject(theme, window, "theme")
|
||||
|
||||
callCoro("saved_accounts.any_saved", [], any => {
|
||||
py.ready = true
|
||||
|
@@ -1,194 +0,0 @@
|
||||
// Copyright 2019 miruka
|
||||
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||
|
||||
import QtQuick 2.12
|
||||
import "utils.js" as Ut
|
||||
|
||||
QtObject {
|
||||
id: theme
|
||||
|
||||
property int minimumSupportedWidth: 240
|
||||
property int minimumSupportedHeight: 120
|
||||
property int contentIsWideAbove: 439
|
||||
|
||||
property int minimumSupportedWidthPlusSpacing: 240 + spacing * 2
|
||||
property int minimumSupportedHeightPlusSpacing: 120 + spacing * 2
|
||||
|
||||
property int baseElementsHeight: 36
|
||||
property int spacing: 8
|
||||
property int animationDuration: 100
|
||||
|
||||
property QtObject fontSize: QtObject {
|
||||
property int smallest: 6
|
||||
property int smaller: 8
|
||||
property int small: 13
|
||||
property int normal: 16
|
||||
property int big: 22
|
||||
property int bigger: 32
|
||||
property int biggest: 48
|
||||
}
|
||||
|
||||
property QtObject fontFamily: QtObject {
|
||||
property string sans: "SFNS Display"
|
||||
property string serif: "Roboto Slab"
|
||||
property string mono: "Hack"
|
||||
}
|
||||
|
||||
property int radius: 5
|
||||
|
||||
property QtObject colors: QtObject {
|
||||
property color background0: Ut.hsla(0, 0, 90, 0.5)
|
||||
property color background1: Ut.hsla(0, 0, 90, 0.6)
|
||||
property color background2: Ut.hsla(0, 0, 90, 0.7)
|
||||
property color foreground: "black"
|
||||
property color foregroundDim: Ut.hsl(0, 0, 20)
|
||||
property color foregroundDim2: Ut.hsl(0, 0, 30)
|
||||
property color foregroundError: Ut.hsl(342, 64, 32)
|
||||
property color textBorder: Ut.hsla(0, 0, 0, 0.07)
|
||||
property color accent: Ut.hsl(25, 60, 50)
|
||||
property color accentDarker: Ut.hsl(25, 60, 35)
|
||||
}
|
||||
|
||||
property QtObject controls: QtObject {
|
||||
property QtObject button: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject interactiveRectangle: QtObject {
|
||||
property color background: "transparent"
|
||||
property color hoveredBackground: Ut.hsla(0, 0, 0, 0.2)
|
||||
property color pressedBackground: Ut.hsla(0, 0, 0, 0.4)
|
||||
property color checkedBackground: Ut.hsla(0, 0, 0, 0.4)
|
||||
}
|
||||
|
||||
property QtObject textField: QtObject {
|
||||
property color background: colors.background2
|
||||
property color border: "transparent"
|
||||
property color focusedBackground: background
|
||||
property color focusedBorder: colors.accent
|
||||
property int borderWidth: 1
|
||||
}
|
||||
|
||||
property QtObject textArea: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject sidePane: QtObject {
|
||||
property real autoWidthRatio: 0.33
|
||||
property int maximumAutoWidth: 320
|
||||
|
||||
property int autoCollapseBelowWidth: 128
|
||||
property int collapsedWidth: avatar.size
|
||||
|
||||
property int autoReduceBelowWindowWidth:
|
||||
minimumSupportedWidthPlusSpacing + collapsedWidth
|
||||
|
||||
property color background: colors.background2
|
||||
|
||||
property QtObject account: QtObject {
|
||||
property color background: Qt.lighter(colors.background2, 1.05)
|
||||
}
|
||||
|
||||
property QtObject settingsButton: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject filterRooms: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject chat: QtObject {
|
||||
property QtObject selectViewBar: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject roomHeader: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject eventList: QtObject {
|
||||
property int ownEventsOnRightUnderWidth: 768
|
||||
property color background: "transparent"
|
||||
}
|
||||
|
||||
property QtObject message: QtObject {
|
||||
property color ownBackground: Ut.hsla(25, 40, 82, 0.7)
|
||||
property color background: colors.background2
|
||||
property color body: colors.foreground
|
||||
property color date: colors.foregroundDim
|
||||
|
||||
property color link: colors.accentDarker
|
||||
// property color code: Ut.hsl(0, 0, 80)
|
||||
// property color codeBackground: Ut.hsl(0, 0, 10)
|
||||
property color code: Ut.hsl(265, 60, 35)
|
||||
property color greenText: Ut.hsl(80, 60, 25)
|
||||
|
||||
property string styleSheet:
|
||||
"a { color: " + link + " }" +
|
||||
|
||||
"code { font-family: " + fontFamily.mono + "; " +
|
||||
"color: " + code + " }" +
|
||||
|
||||
"h1, h2 { font-weight: normal }" +
|
||||
"h6 { font-size: small }" +
|
||||
|
||||
".greentext { color: " + greenText + " }"
|
||||
|
||||
property string styleInclude:
|
||||
'<style type"text/css">\n' + styleSheet + '\n</style>\n'
|
||||
}
|
||||
|
||||
property QtObject daybreak: QtObject {
|
||||
property color background: colors.background2
|
||||
property color foreground: colors.foreground
|
||||
property int radius: theme.radius
|
||||
}
|
||||
|
||||
property QtObject inviteBanner: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject leftBanner: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject unknownDevices: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
|
||||
property QtObject typingMembers: QtObject {
|
||||
property color background: colors.background1
|
||||
}
|
||||
|
||||
property QtObject sendBox: QtObject {
|
||||
property color background: colors.background2
|
||||
}
|
||||
}
|
||||
|
||||
property color pageHeadersBackground: colors.background2
|
||||
|
||||
property QtObject box: QtObject {
|
||||
property color background: colors.background0
|
||||
property int radius: theme.radius
|
||||
}
|
||||
|
||||
property QtObject avatar: QtObject {
|
||||
property int size: baseElementsHeight
|
||||
property int radius: theme.radius
|
||||
property color letter: "white"
|
||||
|
||||
property QtObject background: QtObject {
|
||||
property real saturation: 0.22
|
||||
property real lightness: 0.5
|
||||
property real alpha: 1
|
||||
property color unknown: Ut.hsl(0, 0, 22)
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject displayName: QtObject {
|
||||
property real saturation: 0.32
|
||||
property real lightness: 0.3
|
||||
}
|
||||
}
|
@@ -8,8 +8,8 @@ import "Models"
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
minimumWidth: theme.minimumSupportedWidth
|
||||
minimumHeight: theme.minimumSupportedHeight
|
||||
minimumWidth: theme ? theme.minimumSupportedWidth : 240
|
||||
minimumHeight: theme ? theme.minimumSupportedHeight : 120
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
@@ -34,7 +34,8 @@ ApplicationWindow {
|
||||
property var uiState: ({})
|
||||
onUiStateChanged: py.saveConfig("ui_state", uiState)
|
||||
|
||||
Theme { id: theme }
|
||||
property var theme: null
|
||||
|
||||
Shortcuts { id: shortcuts}
|
||||
Python { id: py }
|
||||
|
||||
|
Reference in New Issue
Block a user