element-web/res/css/views/elements/_Pill.pcss
Robin a0795c7518
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
2024-03-22 00:27:13 +00:00

104 lines
2.9 KiB
Text

/*
Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
.mx_Pill {
padding: $font-1px 0.4em $font-1px 0.4em;
line-height: $font-17px;
border-radius: $font-16px;
vertical-align: text-top;
display: inline-flex;
align-items: center;
box-sizing: border-box;
max-width: 100%;
overflow: hidden;
cursor: pointer;
color: var(--cpd-color-text-on-solid-primary) !important; /* To override .markdown-body */
background-color: $pill-bg-color !important; /* To override .markdown-body */
> * {
pointer-events: none;
}
&.mx_UserPill_me,
&.mx_AtRoomPill {
background-color: var(--cpd-color-bg-critical-primary) !important; /* To override .markdown-body */
}
&:hover {
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
) !important; /* To override .markdown-body | same on both themes */
}
/* We don't want to indicate clickability */
&.mx_AtRoomPill:hover {
background-color: var(--cpd-color-bg-critical-primary) !important; /* To override .markdown-body */
cursor: unset;
}
&::before,
.mx_BaseAvatar {
margin-inline-start: -0.3em; /* Otherwise the gap is too large */
margin-inline-end: 0.2em;
min-width: $font-16px; /* ensure the avatar is not compressed */
}
.mx_Pill_text {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
a& {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-decoration: none !important; /* To override .markdown-body */
}
.mx_Pill_LinkIcon {
background-color: $link-external;
box-sizing: border-box;
color: $background;
height: 16px;
padding: 1px;
width: 16px;
border-radius: 50%;
}
.mx_Pill_UserIcon {
box-sizing: border-box;
color: $secondary-content;
height: 16px;
width: 16px;
}
&.mx_SpacePill {
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
padding-left: 4px;
}
}