New option: bg_mode

This commit is contained in:
Eric Kotato 2018-06-06 15:37:39 +03:00
parent 87f27c4550
commit 38494c1b9a
3 changed files with 21 additions and 1 deletions

View file

@ -20,6 +20,7 @@ Create file `theme.conf.user` in theme folder. See `slice/theme.conf` for refere
* `font` - overall font. Defaults to `Roboto`.
* `background` - path to background image. If not set, falls back to `color_bg`. Not set by default.
* `bg_mode` - background image fill mode. Can be either `aspect`, `fill`, `tile` or `none`. Defaults to `aspect`.
* `parallax_bg_shift` - shifting of parallax background on tab change in pixels. `0` disables parallax motion. Negative values will scroll background in opposite direction. Default is `20`.
* `color_bg` - main background color. Defaults to `#222222`.
* `color_button_bg_idle` - button background color (in idle state). Defaults to `#888888`.

View file

@ -58,6 +58,24 @@ Rectangle
TextConstants { id: localeText }
function bgFillMode() {
switch(config.bg_mode)
{
case "aspect":
return Image.PreserveAspectCrop;
case "fill":
return Image.Stretch;
case "tile":
return Image.Tile;
default:
return Image.Pad;
}
}
Background
{
id: background
@ -66,7 +84,7 @@ Rectangle
width: geometry.width + Math.abs(config.parallax_bg_shift*2)
height: geometry.height
source: config.background
fillMode: Image.PreserveAspectCrop
fillMode: bgFillMode()
visible: status != Image.Error
Behavior on x { NumberAnimation { duration: 150 } }

View file

@ -1,6 +1,7 @@
[General]
font=Roboto
background=
bg_mode=aspect
parallax_bg_shift=20
color_bg=#222222
color_button_bg_idle=#888888