Improve readability of badges and pills (#12360)
* Improve readability of badges and pills Badges will now always use light theme colors so that they become white-on-gray in both themes, and the contrast of pills has been increased so that they use primary action colors as the background. * Fix tests
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
@ -42,6 +42,10 @@ limitations under the License.
|
|||
background-color: $pill-hover-bg-color !important; /* To override .markdown-body */
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: $pill-press-bg-color !important; /* To override .markdown-body */
|
||||
}
|
||||
|
||||
&.mx_UserPill_me:hover {
|
||||
background-color: var(
|
||||
--cpd-color-bg-critical-hovered
|
||||
|
|
|
@ -125,8 +125,9 @@ $roomheader-addroom-fg-color: $primary-content;
|
|||
|
||||
/* Rich-text-editor */
|
||||
/* ******************** */
|
||||
$pill-bg-color: var(--cpd-color-gray-1000);
|
||||
$pill-hover-bg-color: var(--cpd-color-gray-1100);
|
||||
$pill-bg-color: var(--cpd-color-bg-action-primary-rest);
|
||||
$pill-hover-bg-color: var(--cpd-color-bg-action-primary-hovered);
|
||||
$pill-press-bg-color: var(--cpd-color-bg-action-primary-pressed);
|
||||
/* ******************** */
|
||||
|
||||
/* Inputs */
|
||||
|
|
|
@ -28,8 +28,9 @@ $light-fg-color: $header-panel-text-secondary-color;
|
|||
/* used for focusing form controls */
|
||||
$focus-bg-color: $room-highlight-color;
|
||||
|
||||
$pill-bg-color: var(--cpd-color-gray-1000);
|
||||
$pill-hover-bg-color: var(--cpd-color-gray-1100);
|
||||
$pill-bg-color: var(--cpd-color-bg-action-primary-rest);
|
||||
$pill-hover-bg-color: var(--cpd-color-bg-action-primary-hovered);
|
||||
$pill-press-bg-color: var(--cpd-color-bg-action-primary-pressed);
|
||||
|
||||
/* informational plinth */
|
||||
$info-plinth-bg-color: $header-panel-bg-color;
|
||||
|
|
|
@ -123,8 +123,9 @@ $rte-code-bg-color: rgba(0, 0, 0, 0.04);
|
|||
|
||||
$header-panel-text-primary-color: #91a1c0;
|
||||
|
||||
$pill-bg-color: var(--cpd-color-gray-1000);
|
||||
$pill-hover-bg-color: var(--cpd-color-gray-1100);
|
||||
$pill-bg-color: var(--cpd-color-bg-action-primary-rest);
|
||||
$pill-hover-bg-color: var(--cpd-color-bg-action-primary-hovered);
|
||||
$pill-press-bg-color: var(--cpd-color-bg-action-primary-pressed);
|
||||
|
||||
$topleftmenu-color: #212121;
|
||||
$roomheader-bg-color: $primary-bg-color;
|
||||
|
|
|
@ -125,6 +125,7 @@ $reaction-row-button-selected-bg-color: var(
|
|||
$menu-selected-color: var(--menu-selected-color, $menu-selected-color);
|
||||
$pill-bg-color: var(--other-user-pill-bg-color, $pill-bg-color);
|
||||
$pill-hover-bg-color: var(--other-user-pill-bg-color, $pill-hover-bg-color);
|
||||
$pill-press-bg-color: var(--other-user-pill-bg-color, $pill-press-bg-color);
|
||||
$icon-button-color: var(--icon-button-color, $icon-button-color);
|
||||
|
||||
$strong-input-border-color: var(--strong-input-border-color, $strong-input-border-color);
|
||||
|
|
|
@ -159,8 +159,9 @@ $roomheader-addroom-fg-color: #5c6470;
|
|||
|
||||
/* Rich-text-editor */
|
||||
/* ******************** */
|
||||
$pill-bg-color: var(--cpd-color-gray-1000);
|
||||
$pill-hover-bg-color: var(--cpd-color-gray-1100);
|
||||
$pill-bg-color: var(--cpd-color-bg-action-primary-rest);
|
||||
$pill-hover-bg-color: var(--cpd-color-bg-action-primary-hovered);
|
||||
$pill-press-bg-color: var(--cpd-color-bg-action-primary-pressed);
|
||||
$rte-bg-color: #e9e9e9;
|
||||
$rte-code-bg-color: rgba(0, 0, 0, 0.04);
|
||||
/* ******************** */
|
||||
|
|
|
@ -81,16 +81,18 @@ export const StatelessNotificationBadge = forwardRef<HTMLDivElement, XOR<Props,
|
|||
: "badge_3char";
|
||||
|
||||
const classes = classNames({
|
||||
mx_NotificationBadge: true,
|
||||
mx_NotificationBadge_visible: isEmptyBadge || knocked ? true : hasUnreadCount,
|
||||
mx_NotificationBadge_level_notification: level == NotificationLevel.Notification,
|
||||
mx_NotificationBadge_level_highlight: level >= NotificationLevel.Highlight,
|
||||
mx_NotificationBadge_knocked: knocked,
|
||||
"mx_NotificationBadge": true,
|
||||
"mx_NotificationBadge_visible": isEmptyBadge || knocked ? true : hasUnreadCount,
|
||||
"mx_NotificationBadge_level_notification": level == NotificationLevel.Notification,
|
||||
"mx_NotificationBadge_level_highlight": level >= NotificationLevel.Highlight,
|
||||
"mx_NotificationBadge_knocked": knocked,
|
||||
|
||||
// Exactly one of mx_NotificationBadge_dot, mx_NotificationBadge_2char, mx_NotificationBadge_3char
|
||||
mx_NotificationBadge_dot: badgeType === "dot",
|
||||
mx_NotificationBadge_2char: badgeType === "badge_2char",
|
||||
mx_NotificationBadge_3char: badgeType === "badge_3char",
|
||||
"mx_NotificationBadge_dot": badgeType === "dot",
|
||||
"mx_NotificationBadge_2char": badgeType === "badge_2char",
|
||||
"mx_NotificationBadge_3char": badgeType === "badge_3char",
|
||||
// Badges with text should always use light colors
|
||||
"cpd-theme-light": badgeType !== "dot",
|
||||
});
|
||||
|
||||
if (props.onClick) {
|
||||
|
|
|
@ -12,7 +12,7 @@ exports[`RoomStatusBar <RoomStatusBar /> unsent messages should render warning w
|
|||
class="mx_RoomStatusBar_unsentBadge"
|
||||
>
|
||||
<div
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char"
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char cpd-theme-light"
|
||||
>
|
||||
<span
|
||||
class="mx_NotificationBadge_count"
|
||||
|
@ -81,7 +81,7 @@ exports[`RoomStatusBar <RoomStatusBar /> unsent messages should render warning w
|
|||
class="mx_RoomStatusBar_unsentBadge"
|
||||
>
|
||||
<div
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char"
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char cpd-theme-light"
|
||||
>
|
||||
<span
|
||||
class="mx_NotificationBadge_count"
|
||||
|
|
|
@ -215,7 +215,7 @@ exports[`RoomView for a local room in state ERROR should match the snapshot 1`]
|
|||
class="mx_RoomStatusBar_unsentBadge"
|
||||
>
|
||||
<div
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char"
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_highlight mx_NotificationBadge_2char cpd-theme-light"
|
||||
>
|
||||
<span
|
||||
class="mx_NotificationBadge_count"
|
||||
|
|
|
@ -480,7 +480,7 @@ exports[`<Notifications /> correctly handles the loading/disabled state 1`] = `
|
|||
<span>
|
||||
Show a badge
|
||||
<div
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char"
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char cpd-theme-light"
|
||||
>
|
||||
<span
|
||||
class="mx_NotificationBadge_count"
|
||||
|
@ -1190,7 +1190,7 @@ exports[`<Notifications /> matches the snapshot 1`] = `
|
|||
<span>
|
||||
Show a badge
|
||||
<div
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char"
|
||||
class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char cpd-theme-light"
|
||||
>
|
||||
<span
|
||||
class="mx_NotificationBadge_count"
|
||||
|
|
|
@ -26,7 +26,7 @@ exports[`SpaceButton metaspace should render notificationState if one is provide
|
|||
class="mx_SpacePanel_badgeContainer"
|
||||
>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char"
|
||||
class="mx_AccessibleButton mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_level_notification mx_NotificationBadge_2char cpd-theme-light"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
>
|
||||
|
|