From 017888c9a8fd07f62403103eec42340233faac44 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Sun, 12 Jan 2025 02:29:26 +0100 Subject: [PATCH] Rework how buttons react to :hover and :active Instead of having two different types of effects (hover had a different color, and active had a 3d-effect simulating a pressed button), we now have an increasing activation-level. That means the button goes a bit dark for hover, and then even darker when pressed. There is also a variant that goes lighter for each activation level, that can be used when the initial color is dark. With this change, we can get rid of special :hover and :active styling for the connect button and the control bar buttons. We can use the same activation level principle for all buttons. --- app/styles/base.css | 31 --------- app/styles/input.css | 155 ++++++++++++++++++++++++------------------- 2 files changed, 85 insertions(+), 101 deletions(-) diff --git a/app/styles/base.css b/app/styles/base.css index 3c96933f..fba8981e 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -392,40 +392,15 @@ html { border:1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; background-color: transparent; - background-image: unset; /* we don't want the gradiant from input.css */ } #noVNC_control_bar .noVNC_button.noVNC_selected { border-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.5); } -#noVNC_control_bar .noVNC_button.noVNC_selected:not(:disabled):hover { - border-color: rgba(0, 0, 0, 0.4); - background-color: rgba(0, 0, 0, 0.2); -} -#noVNC_control_bar .noVNC_button:not(:disabled):hover { - background-color: rgba(255, 255, 255, 0.2); -} -#noVNC_control_bar .noVNC_button:not(:disabled):active { - padding-top: 5px; - padding-bottom: 3px; -} #noVNC_control_bar .noVNC_button.noVNC_hidden { display: none !important; } -/* Android browsers don't properly update hover state if touch events are - * intercepted, like they are when clicking on the remote screen. */ -@media (any-pointer: coarse) { - #noVNC_control_bar .noVNC_button:not(:disabled):hover { - background-color: transparent; - } - #noVNC_control_bar .noVNC_button.noVNC_selected:not(:disabled):hover { - border-color: rgba(0, 0, 0, 0.8); - background-color: rgba(0, 0, 0, 0.5); - } -} - - /* Panels */ .noVNC_panel { transform: translateX(25px); @@ -763,12 +738,6 @@ html { background-color: var(--novnc-blue); color: white; - - /* This avoids it jumping around when :active */ - vertical-align: middle; -} -#noVNC_connect_button:hover { - background-color: var(--novnc-darkblue); } #noVNC_connect_button img { diff --git a/app/styles/input.css b/app/styles/input.css index 7aa3dc7f..e4c5b1a1 100644 --- a/app/styles/input.css +++ b/app/styles/input.css @@ -24,6 +24,71 @@ input, input::file-selector-button, button, select, textarea { border-radius: 6px; } +/* + * Button activations + */ + +/* A color overlay that depends on the activation level. The level can then be + set for different states on an element, for example hover and click on a +