From b5dae5b567e6ae5a03945cbc9402ef47f58f6907 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Tue, 17 Jun 2014 11:44:05 +0200 Subject: [PATCH] canvas.gui: Button color tweaking. --- Nasal/canvas/gui/styles/DefaultStyle.nas | 21 ++++++++++++--------- gui/styles/AmbianceClassic/style.xml | 12 ++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Nasal/canvas/gui/styles/DefaultStyle.nas b/Nasal/canvas/gui/styles/DefaultStyle.nas index ec177e4a0..9663207fe 100644 --- a/Nasal/canvas/gui/styles/DefaultStyle.nas +++ b/Nasal/canvas/gui/styles/DefaultStyle.nas @@ -61,6 +61,18 @@ DefaultStyle.widgets.button = { var (w, h) = model._size; var file = me._style._dir_widgets ~ "/"; + # TODO unify color names with image names + var bg_color_name = "button_bg_color"; + if( backdrop ) + bg_color_name = "button_backdrop_bg_color"; + else if( !model._enabled ) + bg_color_name = "button_bg_color_insensitive"; + else if( model._down ) + bg_color_name = "button_bg_color_down"; + else if( model._hover ) + bg_color_name = "button_bg_color_hover"; + me._bg.set("fill", me._style.getColor(bg_color_name)); + if( backdrop ) { file ~= "backdrop-"; @@ -78,25 +90,16 @@ DefaultStyle.widgets.button = { else me._label.setTranslation(w / 2, h / 2 + 5); - if( model._enabled ) { if( model._focused and !backdrop ) file ~= "-focused"; if( model._hover and !model._down ) - { file ~= "-hover"; - me._bg.set("fill", me._style.getColor("button_bg_color_hover")); - } - else - me._bg.set("fill", me._style.getColor("button_bg_color")); } else - { file ~= "-disabled"; - me._bg.set("fill", me._style.getColor("button_bg_color_insensitive")); - } me._border.set("src", file ~ ".png"); } diff --git a/gui/styles/AmbianceClassic/style.xml b/gui/styles/AmbianceClassic/style.xml index 42ef16fa8..9195affe3 100644 --- a/gui/styles/AmbianceClassic/style.xml +++ b/gui/styles/AmbianceClassic/style.xml @@ -72,6 +72,18 @@ 0.941 + + 0.909 + 0.905 + 0.901 + + + + 0.88 + 0.87 + 0.86 + + 0.996 0.992