on xenial help sign in
Fix background luminance.
commit05dbc8bfd97867678825b3a9f6b462bdb2032f09 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 14 Aug 2014, 13:53 (12 years ago) parentb7062dd
2 files changed+5−7
plugins/Dash/ScopeStyle.qml+3−3 tests/plugins/Dash/tst_ScopeStyle.qml+2−4
plugins/Dash/ScopeStyle.qml+3−3
@@ -32,13 +32,13 @@ QtObject {
3232 readonly property color foreground: "foreground-color" in style ? style["foreground-color"] : d.defaultDark
3333
3434 /// 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)
3636
3737 /// 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"
3939
4040 /// 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)
4242
4343 /*! \brief Luminance threshold for switching between fore and background color
4444
tests/plugins/Dash/tst_ScopeStyle.qml+2−4
@@ -68,7 +68,7 @@ Rectangle {
6868
6969 function test_background_data() {
7070 return [
71− { tag: "default", index: 0, background: "transparent" },
71+ { tag: "default", index: 0, background: "#00f5f5f5", luminance: 0.9608 },
7272 { tag: "red on black", index: 1, background: "black", luminance: 0 },
7373 { tag: "green on white", index: 2, background: "white", luminance: 1 },
7474 { tag: "blue on darkgrey", index: 3, background: "darkgrey", luminance: 0.6627 },
@@ -79,9 +79,7 @@ Rectangle {
7979 tool.style = testCase.styles[data.index];
8080 verify(Qt.colorEqual(tool.background, data.background),
8181 "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));
84− }
82+ compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
8583 }
8684
8785 function test_threshold_data() {