[fractal/fractal-next] style: Cleanup



commit 6ee656706a1f70002627ef4460af9361345fdefe
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Fri Jan 28 13:30:08 2022 +0100

    style: Cleanup
    
    Remove unused styles
    Remove redundancies with libadwaita style
    Always use named colors
    Always use relative font-size
    Use libadwaita styles as much as possible

 data/resources/style-dark.css               | 16 ------
 data/resources/style.css                    | 81 ++++++++++-------------------
 data/resources/ui/components-auth-dialog.ui |  4 +-
 data/resources/ui/content-invite.ui         |  7 +--
 data/resources/ui/content-room-details.ui   | 40 +++++++++-----
 data/resources/ui/content-room-history.ui   |  3 +-
 data/resources/ui/user-entry-row.ui         |  3 +-
 src/session/content/room_details/mod.rs     |  4 +-
 8 files changed, 64 insertions(+), 94 deletions(-)
---
diff --git a/data/resources/style-dark.css b/data/resources/style-dark.css
index 21ee2a1b..1a6ae1d7 100644
--- a/data/resources/style-dark.css
+++ b/data/resources/style-dark.css
@@ -1,20 +1,4 @@
-#new-login-icon {
-  background-color: alpha(black, 0.8);
-}
-
 .devnotice {
   background: @warning_bg_color;
   color: @warning_fg_color;
 }
-
-button.cutout {
-  color: alpha(black, 0.8);
-}
-
-message-reactions .toggle {
-  border-color: @dark_2;
-}
-
-message-reactions .toggle:checked {
-  border-color: @blue_5;
-}
\ No newline at end of file
diff --git a/data/resources/style.css b/data/resources/style.css
index 79dd4faa..120d80d3 100644
--- a/data/resources/style.css
+++ b/data/resources/style.css
@@ -10,19 +10,19 @@
 .room-details-group entry:disabled {
   border-color: transparent;
   /* Undo non-sensitive style. */
-  color: @theme_text_color;
+  color: @view_fg_color;
   background: none;
 }
 
 .room-details-group entry textview {
   /* Undo non-sensitive style. */
-  color: @theme_text_color;
+  color: @view_fg_color;
   background: none;
 }
 
 .room-details-group entry text {
   /* Undo non-sensitive style. */
-  color: @theme_text_color;
+  color: @view_fg_color;
   background: none;
 }
 
@@ -36,42 +36,35 @@
 }
 
 .badge {
-  color: white;
-  background-color: lightgrey;
+  color: @dark_5;
+  background-color: @light_3;
   border-radius: 0.4em;
   padding: 0.1em 0.5em;
   font-size: 0.8em;
   margin-left: 0.5em;
 }
 
-.admin {
-  color: white;
-  background: #cc5959;
+.badge.admin {
+  color: @light_1;
+  background-color: @red_2;
 }
 
-.mod {
-  color: black;
-  background-color: #cea63a;
+.badge.mod {
+  background-color: @yellow_5;
 }
 
-.title-header {
-  font-size: 36px;
-  font-weight: bold;
-}
-
-.pill-button {
-  border-radius: 9999px;
+button.pill.large {
   padding: 12px 40px;
 }
 
 .inline-pill {
   border-radius: 9999px;
-  background-color: alpha(@theme_text_color, 0.1);
+  background-color: alpha(@view_fg_color, 0.1);
   padding-right: 6px;
 }
 
 .app-notification .inline-pill {
-  background-color: alpha(@theme_bg_color, 0.2);
+  background-color: alpha(@window_bg_color, 0.2);
 }
 
 .selected-avatar avatar {
@@ -79,7 +72,7 @@
 }
 
 .blue-checkmark {
-  color: white;
+  color: @light_1;
   border-radius: 9999px;
   border: solid @accent_bg_color 2px;
   background-color: @accent_bg_color;
@@ -106,11 +99,6 @@
   min-height: 32px;
 }
 
-headerbar.flat {
-  background: none;
-  border: none;
-}
-
 /* Account switcher */
 #account-switcher row {
   border-radius: 10px;
@@ -120,16 +108,12 @@ headerbar.flat {
   padding-bottom: 7px;
 }
 
-#account-switcher .user-id {
-  font-size: 12px;
-}
-
 #new-login-icon {
   /*
    *  2 * padding + pixel-size = size (of avatar)
    */
   padding: 12px;
-  background-color: lightgrey;
+  background-color: alpha(currentColor, .1);
   border-radius: 9999px;
 }
 
@@ -256,7 +240,7 @@ headerbar.flat {
 
 /* Content */
 .room-history {
-  background: @theme_base_color;
+  background: @view_bg_color;
 }
 
 .room-history row {
@@ -299,7 +283,7 @@ headerbar.flat {
 }
 
 .room-history .event-content .quote {
-  border-left: 2px solid @theme_selected_bg_color;
+  border-left: 2px solid @accent_bg_color;
   padding-left: 6px;
   opacity: 0.7;
 }
@@ -307,7 +291,7 @@ headerbar.flat {
 message-reactions .toggle {
   padding: 1px 4px 0 5px;
   background-color: @view_bg_color;
-  border: 1px solid @light_4;
+  border: 1px solid alpha(currentColor, 0.3);
 }
 
 message-reactions .toggle:checked,
@@ -316,7 +300,7 @@ message-reactions .toggle:checked,
 }
 
 message-reactions .toggle:checked {
-  border-color: @blue_2;
+  border-color: alpha(@accent_bg_color, 0.7);
 }
 
 message-reactions .reaction-key {
@@ -325,11 +309,11 @@ message-reactions .reaction-key {
 
 message-reactions .reaction-count {
   font-size: 0.8em;
-  padding-left: 5px;
+  padding-left: 6px;
 }
 
 .reaction-chooser {
-  margin: 5px;
+  margin: 6px;
 }
 
 .reaction-chooser button {
@@ -353,15 +337,11 @@ message-reactions .reaction-count {
   padding: 6px;
   font-family: monospace;
   background-color: @text_view_bg;
-  color: @theme_text_color;
-}
-
-.view {
-  padding: 7px 0;
+  color: @view_fg_color;
 }
 
 .invite-room-name {
-  font-size: 24px;
+  font-size: 1.6em;
 }
 
 .app-notification {
@@ -392,17 +372,10 @@ listview.content row:last-child {
   font-weight: bold;
 }
 
-button.cutout {
-  box-shadow: 0 0 0 2px @theme_bg_color;
-  background-color: #e2e2e1;
-}
-
-button.cutout:hover {
-  background-color: #d8d8d7;
-}
-
-button.cutout:active {
-  background-color: #c4c5c4;
+.cutout-button {
+  background-color: @window_bg_color;
+  border-radius: 9999px;
+  padding: 2px;
 }
 
 .emoji {
diff --git a/data/resources/ui/components-auth-dialog.ui b/data/resources/ui/components-auth-dialog.ui
index 66cc4226..4ca3759f 100644
--- a/data/resources/ui/components-auth-dialog.ui
+++ b/data/resources/ui/components-auth-dialog.ui
@@ -81,7 +81,8 @@
                         <property name="halign">center</property>
                         <style>
                           <class name="suggested-action"/>
-                          <class name="pill-button"/>
+                          <class name="pill"/>
+                          <class name="large"/>
                         </style>
                       </object>
                     </child>
@@ -129,4 +130,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/data/resources/ui/content-invite.ui b/data/resources/ui/content-invite.ui
index 7c8b5d0c..2ebcf6d0 100644
--- a/data/resources/ui/content-invite.ui
+++ b/data/resources/ui/content-invite.ui
@@ -109,7 +109,8 @@
                             <property name="label" translatable="yes">_Reject</property>
                             <property name="action-name">invite.reject</property>
                             <style>
-                              <class name="pill-button"/>
+                              <class name="pill"/>
+                              <class name="large"/>
                             </style>
                           </object>
                         </child>
@@ -119,7 +120,8 @@
                             <property name="action-name">invite.accept</property>
                             <style>
                               <class name="suggested-action"/>
-                              <class name="pill-button"/>
+                              <class name="pill"/>
+                              <class name="large"/>
                             </style>
                           </object>
                         </child>
@@ -135,4 +137,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/data/resources/ui/content-room-details.ui b/data/resources/ui/content-room-details.ui
index 9f536974..b611a258 100644
--- a/data/resources/ui/content-room-details.ui
+++ b/data/resources/ui/content-room-details.ui
@@ -27,27 +27,39 @@
                   </object>
                 </child>
                 <child type="overlay">
-                  <object class="GtkButton" id="avatar_remove_button">
-                    <property name="icon-name">user-trash-symbolic</property>
-                    <property name="action-name">details.remove-avatar</property>
-                    <property name="halign">end</property>
-                    <property name="valign">start</property>
+                  <object class="AdwBin" id="avatar_remove_button">
                     <style>
-                      <class name="cutout" />
-                      <class name="circular" />
+                      <class name="cutout-button" />
                     </style>
+                    <property name="halign">end</property>
+                    <property name="valign">start</property>
+                    <child>
+                      <object class="GtkButton">
+                        <property name="icon-name">user-trash-symbolic</property>
+                        <property name="action-name">details.remove-avatar</property>
+                        <style>
+                          <class name="circular" />
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child type="overlay">
-                  <object class="GtkButton" id="avatar_edit_button">
-                    <property name="icon-name">document-edit-symbolic</property>
-                    <property name="action-name">details.choose-avatar</property>
-                    <property name="halign">end</property>
-                    <property name="valign">end</property>
+                  <object class="AdwBin" id="avatar_edit_button">
                     <style>
-                      <class name="cutout" />
-                      <class name="circular" />
+                      <class name="cutout-button" />
                     </style>
+                    <property name="halign">end</property>
+                    <property name="valign">end</property>
+                    <child>
+                      <object class="GtkButton">
+                        <property name="icon-name">document-edit-symbolic</property>
+                        <property name="action-name">details.choose-avatar</property>
+                        <style>
+                          <class name="circular" />
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/data/resources/ui/content-room-history.ui b/data/resources/ui/content-room-history.ui
index 473ead9c..42567c47 100644
--- a/data/resources/ui/content-room-history.ui
+++ b/data/resources/ui/content-room-history.ui
@@ -210,6 +210,8 @@
                           <object class="GtkSourceView" id="message_entry">
                             <property name="hexpand">True</property>
                             <property name="accepts-tab">False</property>
+                            <property name="top-margin">7</property>
+                            <property name="bottom-margin">7</property>
                           </object>
                         </property>
                       </object>
@@ -236,4 +238,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/data/resources/ui/user-entry-row.ui b/data/resources/ui/user-entry-row.ui
index 68241553..a7a7b619 100644
--- a/data/resources/ui/user-entry-row.ui
+++ b/data/resources/ui/user-entry-row.ui
@@ -50,7 +50,7 @@
                 </binding>
                 <style>
                   <class name="dim-label"/>
-                  <class name="user-id"/>
+                  <class name="caption"/>
                 </style>
               </object>
             </child>
@@ -71,4 +71,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/src/session/content/room_details/mod.rs b/src/session/content/room_details/mod.rs
index d025044b..e6b35f4a 100644
--- a/src/session/content/room_details/mod.rs
+++ b/src/session/content/room_details/mod.rs
@@ -30,9 +30,9 @@ mod imp {
         pub room: OnceCell<Room>,
         pub avatar_chooser: OnceCell<gtk::FileChooserNative>,
         #[template_child]
-        pub avatar_remove_button: TemplateChild<gtk::Button>,
+        pub avatar_remove_button: TemplateChild<adw::Bin>,
         #[template_child]
-        pub avatar_edit_button: TemplateChild<gtk::Button>,
+        pub avatar_edit_button: TemplateChild<adw::Bin>,
         #[template_child]
         pub edit_toggle: TemplateChild<gtk::ToggleButton>,
         #[template_child]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]