on xenial help sign in
Fix background luminance.
05dbc8bMichał Sawicz
plugins/Dash/ScopeStyle.qml+3−3
@@ -32,13 +32,13 @@ QtObject {
32 readonly property color foreground: "foreground-color" in style ? style["foreground-color"] : d.defaultDark
32 readonly property color foreground: "foreground-color" in style ? style["foreground-color"] : d.defaultDark
33
33
34 /// Luminance of the foreground color
34 /// Luminance of the foreground color
35− readonly property real foregroundLuminance: foreground ? Style.luminance(foreground) : d.defaultForegroundLuminance
35+ readonly property real foregroundLuminance: foreground ? Style.luminance(foreground) : Style.luminance(d.defaultDark)
36
36
37 /// Color used for the overall background
37 /// Color used for the overall background
38− readonly property color background: "background-color" in style ? style["background-color"] : "transparent"
38+ readonly property color background: "background-color" in style ? style["background-color"] : "#00f5f5f5"
39
39
40 /// Luminance of the background color
40 /// Luminance of the background color
41− readonly property real backgroundLuminance: background ? Style.luminance(background) : d.defaultBackgroundLuminance
41+ readonly property real backgroundLuminance: background ? Style.luminance(background) : Style.luminance(d.defaultLight)
42
42
43 /*! \brief Luminance threshold for switching between fore and background color
43 /*! \brief Luminance threshold for switching between fore and background color
44
44
tests/plugins/Dash/tst_ScopeStyle.qml+2−4
@@ -68,7 +68,7 @@ Rectangle {
68
68
69 function test_background_data() {
69 function test_background_data() {
70 return [
70 return [
71− { tag: "default", index: 0, background: "transparent" },
71+ { tag: "default", index: 0, background: "#00f5f5f5", luminance: 0.9608 },
72 { tag: "red on black", index: 1, background: "black", luminance: 0 },
72 { tag: "red on black", index: 1, background: "black", luminance: 0 },
73 { tag: "green on white", index: 2, background: "white", luminance: 1 },
73 { tag: "green on white", index: 2, background: "white", luminance: 1 },
74 { tag: "blue on darkgrey", index: 3, background: "darkgrey", luminance: 0.6627 },
74 { tag: "blue on darkgrey", index: 3, background: "darkgrey", luminance: 0.6627 },
@@ -79,9 +79,7 @@ Rectangle {
79 tool.style = testCase.styles[data.index];
79 tool.style = testCase.styles[data.index];
80 verify(Qt.colorEqual(tool.background, data.background),
80 verify(Qt.colorEqual(tool.background, data.background),
81 "Background color not equal: %1 != %2".arg(tool.background).arg(data.background));
81 "Background color not equal: %1 != %2".arg(tool.background).arg(data.background));
82− if (data.hasOwnProperty("luminance")) {
83− compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
82+ compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
84− }
85 }
83 }
86
84
87 function test_threshold_data() {
85 function test_threshold_data() {