Changeset dac9ce5 in subsurface


Ignore:
Timestamp:
Jun 23, 2017, 6:48:41 PM (4 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
694e833
Parents:
3f055ac
git-author:
Dirk Hohndel <dirk@…> (06/23/17 12:29:22)
git-committer:
Dirk Hohndel <dirk@…> (06/23/17 18:48:41)
Message:

QML UI: clean up the setting of theme colors

Let's have names for the colors in each theme and assign those
named values to the theme colors when switching themes. This
way other pages can access the colors that are not in the current
theme (for example for a theme switcher).

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qml/main.qml

    r3f055ac rdac9ce5  
    329329
    330330        function blueTheme() {
    331                 subsurfaceTheme.darkPrimaryColor = "#303F9f"
    332                 subsurfaceTheme.darkPrimaryTextColor= "#ECECEC"
    333                 subsurfaceTheme.primaryColor = "#3F51B5"
    334                 subsurfaceTheme.primaryTextColor = "#ECECEC"
    335                 subsurfaceTheme.lightPrimaryColor = "#C5CAE9"
    336                 subsurfaceTheme.lightPrimaryTextColor = "#212121"
    337                 subsurfaceTheme.backgroundColor = "#eff0f1"
     331                subsurfaceTheme.currentTheme = "Blue"
     332                subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.blueDarkerPrimaryColor
     333                subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.blueDarkerPrimaryTextColor
     334                subsurfaceTheme.primaryColor = subsurfaceTheme.bluePrimaryColor
     335                subsurfaceTheme.primaryTextColor = subsurfaceTheme.bluePrimaryTextColor
     336                subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.blueLightPrimaryColor
     337                subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.blueLightPrimaryTextColor
     338                subsurfaceTheme.backgroundColor = subsurfaceTheme.blueBackgroundColor
    338339                subsurfaceTheme.diveListTextColor = subsurfaceTheme.lightPrimaryTextColor
    339340                manager.setStatusbarColor(subsurfaceTheme.darkPrimaryColor)
     
    341342
    342343        function pinkTheme() {
    343                 subsurfaceTheme.darkPrimaryColor = "#FF1493"
    344                 subsurfaceTheme.darkPrimaryTextColor = "#ECECEC"
    345                 subsurfaceTheme.primaryColor = "#FF69B4"
    346                 subsurfaceTheme.primaryTextColor = "#212121"
    347                 subsurfaceTheme.lightPrimaryColor = "#FFDDF4"
    348                 subsurfaceTheme.lightPrimaryTextColor = "#212121"
    349                 subsurfaceTheme.backgroundColor = "#eff0f1"
     344                subsurfaceTheme.currentTheme = "Pink"
     345                subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.pinkDarkerPrimaryColor
     346                subsurfaceTheme.darkerPrimaryTextColor = subsurfaceTheme.pinkDarkerPrimaryTextColor
     347                subsurfaceTheme.primaryColor = subsurfaceTheme.pinkPrimaryColor
     348                subsurfaceTheme.primaryTextColor = subsurfaceTheme.pinkPrimaryTextColor
     349                subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.pinkLightPrimaryColor
     350                subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.pinkLightPrimaryTextColor
     351                subsurfaceTheme.backgroundColor = subsurfaceTheme.pinkBackgroundColor
    350352                subsurfaceTheme.diveListTextColor = subsurfaceTheme.lightPrimaryTextColor
    351353                manager.setStatusbarColor(subsurfaceTheme.darkPrimaryColor)
     
    353355
    354356        function darkTheme() {
    355                 subsurfaceTheme.darkPrimaryColor = "#303F9f"
    356                 subsurfaceTheme.darkPrimaryTextColor= "#ECECEC"
    357                 subsurfaceTheme.primaryColor = "#3F51B5"
    358                 subsurfaceTheme.primaryTextColor = "#ECECEC"
    359                 subsurfaceTheme.lightPrimaryColor = "#C5CAE9"
    360                 subsurfaceTheme.lightPrimaryTextColor = "#212121"
    361                 subsurfaceTheme.backgroundColor = "#000000"
     357                subsurfaceTheme.currentTheme = "Dark"
     358                subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.darkDarkerPrimaryColor
     359                subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.darkDarkerPrimaryTextColor
     360                subsurfaceTheme.primaryColor = subsurfaceTheme.darkPrimaryColor
     361                subsurfaceTheme.primaryTextColor = subsurfaceTheme.darkPrimaryTextColor
     362                subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.darkLightPrimaryColor
     363                subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.darkLightPrimaryTextColor
     364                subsurfaceTheme.backgroundColor = subsurfaceTheme.darkBackgroundColor
    362365                subsurfaceTheme.diveListTextColor = subsurfaceTheme.primaryTextColor
    363366                manager.setStatusbarColor(subsurfaceTheme.darkPrimaryColor)
     
    369372                property int smallPointSize: Math.round(fontMetrics.font.pointSize * 0.8)
    370373
    371                 property color darkPrimaryColor: "#303F9f"
     374                // colors currently in use
     375                property string currentTheme
     376                property color darkerPrimaryColor
     377                property color darkerPrimaryTextColor
     378                property color primaryColor
     379                property color primaryTextColor
     380                property color lightPrimaryColor
     381                property color lightPrimaryTextColor
     382                property color backgroundColor
     383                property color diveListTextColor
     384
     385                // colors for the blue theme
     386                property color blueDarkerPrimaryColor: "#303F9f"
     387                property color blueDarkerPrimaryTextColor: "#ECECEC"
     388                property color bluePrimaryColor: "#3F51B5"
     389                property color bluePrimaryTextColor: "#ECECEC"
     390                property color blueLightPrimaryColor: "#C5CAE9"
     391                property color blueLightPrimaryTextColor: "#212121"
     392                property color blueBackgroundColor: "#eff0f1"
     393
     394                // colors for the pink theme
     395                property color pinkDarkerPrimaryColor: "#FF1493"
     396                property color pinkDarkerPrimaryTextColor: "#ECECEC"
     397                property color pinkPrimaryColor: "#FF69B4"
     398                property color pinkPrimaryTextColor: "#212121"
     399                property color pinkLightPrimaryColor: "#FFDDF4"
     400                property color pinkLightPrimaryTextColor: "#212121"
     401                property color pinkBackgroundColor: "#eff0f1"
     402
     403                // colors for the dark theme
     404                property color darkDarkerPrimaryColor: "#303F9f"
     405                property color darkDarkerPrimaryTextColor: "#ECECEC"
     406                property color darkPrimaryColor: "#3F51B5"
    372407                property color darkPrimaryTextColor: "#ECECEC"
    373                 property color primaryColor: "#3F51B5"
    374                 property color primaryTextColor: "#ECECEC"
    375                 property color lightPrimaryColor: "#C5CAE9"
    376                 property color lightPrimaryTextColor: "#212121"
     408                property color darkLightPrimaryColor: "#C5CAE9"
     409                property color darkLightPrimaryTextColor: "#212121"
     410                property color darkBackgroundColor: "#000000"
     411
    377412                property color contrastAccentColor: "#FF9800" // used for delete button
    378 
    379                 property color backgroundColor: "#eff0f1"
    380 
    381                 property color diveListTextColor: lightPrimaryTextColor
    382413
    383414                property int columnWidth: Math.round(rootItem.width/(Kirigami.Units.gridUnit*28)) > 0 ? Math.round(rootItem.width / Math.round(rootItem.width/(Kirigami.Units.gridUnit*28))) : rootItem.width
     
    388419                        Kirigami.Theme.textColor = Qt.binding(function() { return diveListTextColor })
    389420                        Kirigami.Theme.buttonHoverColor = Qt.binding(function() { return lightPrimaryColor })
    390                         manager.setStatusbarColor(darkPrimaryColor)
     421
     422                        // this needs to pick the theme from persistent preference settings
     423                        blueTheme()
    391424                }
    392425        }
Note: See TracChangeset for help on using the changeset viewer.