From 9044bf532811e1a7abf1b39db8e24c5eda0ede76 Mon Sep 17 00:00:00 2001 From: Lapo Calamandrei Date: Thu, 3 Jul 2014 12:29:25 +0200 Subject: [PATCH] Adwaita: style entry.warning and entry.error Fixes https://bugzilla.gnome.org/show_bug.cgi?id=724084 --- gtk/resources/theme/Adwaita/_common.scss | 24 ++++++++++++++ gtk/resources/theme/Adwaita/_drawing.scss | 13 +++++--- .../theme/Adwaita/gtk-contained-dark.css | 32 +++++++++++++++++++ gtk/resources/theme/Adwaita/gtk-contained.css | 24 ++++++++++++++ 4 files changed, 88 insertions(+), 5 deletions(-) diff --git a/gtk/resources/theme/Adwaita/_common.scss b/gtk/resources/theme/Adwaita/_common.scss index b1797438c3..0a4f8c43c0 100644 --- a/gtk/resources/theme/Adwaita/_common.scss +++ b/gtk/resources/theme/Adwaita/_common.scss @@ -206,6 +206,30 @@ GtkLabel { &:dir(rtl) { border-left-style: solid; } } } + &.error { + color: $error_color; + border-color: $error_color; + &:focus { @include entry(focus, $error_color); } + &:selected, &:selected:focus { + background-color: $error_color; + } + @if $variant == 'dark' { + &:selected:focus { color: $base_color; } + &:selected:backdrop { color: $backdrop_base_color; } + } + } + &.warning { + color: $warning_color; + border-color: $warning_color; + &:focus { @include entry(focus, $warning_color); } + &:selected, &:selected:focus { + background-color: $warning_color; + } + @if $variant == 'dark' { + &:selected:focus { color: $base_color; } + &:selected:backdrop { color: $backdrop_base_color; } + } + } } /*********** diff --git a/gtk/resources/theme/Adwaita/_drawing.scss b/gtk/resources/theme/Adwaita/_drawing.scss index 17140c733c..f51b47fc76 100644 --- a/gtk/resources/theme/Adwaita/_drawing.scss +++ b/gtk/resources/theme/Adwaita/_drawing.scss @@ -17,11 +17,12 @@ $widget_edge: 0 1px $borders_edge; //outer hilight "used" on // entries -@mixin entry($t, $noedge:false) { +@mixin entry($t, $fc:$selected_bg_color, $noedge:false) { // // Entries drawing function // // $t: entry type +// $fc: focus color // $noedge: set to true not to draw the bottom edge hilight // // possible $t values: @@ -43,15 +44,17 @@ $widget_edge: 0 1px $borders_edge; //outer hilight "used" on } @if $t==focus { @if $variant == 'light' { - border-color: $selected_bg_color; + border-color: $fc; @include _shadows(inset 0 2px 2px -2px mix(black, $base_color, 50%), - inset 0 0 2px 1px mix($selected_bg_color,$base_color,20%), + inset 0 0 2px 1px mix($fc,$base_color,20%), $_entry_edge); } @else { - border-color: $selected_borders_color; + border-color: if($fc==$selected_bg_color, + $selected_borders_color, + darken($fc,35%)); @include _shadows(inset 0 2px 2px -2px mix(black, $base_color, 50%), - inset 0 0 1px 1px $selected_bg_color, + inset 0 0 1px 1px $fc, $_entry_edge); } } diff --git a/gtk/resources/theme/Adwaita/gtk-contained-dark.css b/gtk/resources/theme/Adwaita/gtk-contained-dark.css index c21ece90bb..319760063b 100644 --- a/gtk/resources/theme/Adwaita/gtk-contained-dark.css +++ b/gtk/resources/theme/Adwaita/gtk-contained-dark.css @@ -207,6 +207,38 @@ border-left-style: none; } .linked .entry:last-child:dir(rtl) { border-left-style: solid; } + .entry.error { + color: #cc0000; + border-color: #cc0000; } + .entry.error:focus { + background-color: transparent; + border-style: solid; + border-width: 1px; + background-image: linear-gradient(to bottom, #212121, #292929 90%); + border-color: #1a0000; + box-shadow: inset 0 2px 2px -2px #141414, inset 0 0 1px 1px #cc0000, 0 1px rgba(238, 238, 236, 0.1); } + .entry.error:selected, .entry.error:selected:focus { + background-color: #cc0000; } + .entry.error:selected:focus { + color: #292929; } + .entry.error:selected:backdrop { + color: #2c2c2c; } + .entry.warning { + color: #f57900; + border-color: #f57900; } + .entry.warning:focus { + background-color: transparent; + border-style: solid; + border-width: 1px; + background-image: linear-gradient(to bottom, #212121, #292929 90%); + border-color: #432100; + box-shadow: inset 0 2px 2px -2px #141414, inset 0 0 1px 1px #f57900, 0 1px rgba(238, 238, 236, 0.1); } + .entry.warning:selected, .entry.warning:selected:focus { + background-color: #f57900; } + .entry.warning:selected:focus { + color: #292929; } + .entry.warning:selected:backdrop { + color: #2c2c2c; } /*********** * Buttons * diff --git a/gtk/resources/theme/Adwaita/gtk-contained.css b/gtk/resources/theme/Adwaita/gtk-contained.css index 563085c50d..0a8875a4c9 100644 --- a/gtk/resources/theme/Adwaita/gtk-contained.css +++ b/gtk/resources/theme/Adwaita/gtk-contained.css @@ -207,6 +207,30 @@ border-left-style: none; } .linked .entry:last-child:dir(rtl) { border-left-style: solid; } + .entry.error { + color: #cc0000; + border-color: #cc0000; } + .entry.error:focus { + background-color: transparent; + border-style: solid; + border-width: 1px; + background-image: linear-gradient(to bottom, #f7f7f7, white 90%); + border-color: #cc0000; + box-shadow: inset 0 2px 2px -2px #7f7f7f, inset 0 0 2px 1px #f4cccc, 0 1px white; } + .entry.error:selected, .entry.error:selected:focus { + background-color: #cc0000; } + .entry.warning { + color: #f57900; + border-color: #f57900; } + .entry.warning:focus { + background-color: transparent; + border-style: solid; + border-width: 1px; + background-image: linear-gradient(to bottom, #f7f7f7, white 90%); + border-color: #f57900; + box-shadow: inset 0 2px 2px -2px #7f7f7f, inset 0 0 2px 1px #fde4cc, 0 1px white; } + .entry.warning:selected, .entry.warning:selected:focus { + background-color: #f57900; } /*********** * Buttons *