Skip to content

Commit

Permalink
Use Compound primary colors for most actions (matrix-org#12241)
Browse files Browse the repository at this point in the history
* Use Compound primary colors for most actions

The "accent" color variable is something we should generally not use anymore: it maps to a Compound text token, which makes its semantics inappropriate for icons and backgrounds, and it clashes with the primary colors present on the Compound components we're now bringing into the app. As discussed with design, we would like to phase out its usage on interactive components in favor of the correct icon and background colors from Compound. This is a best-effort attempt at applying new colors to all the major places that we were previously using "accent": mainly, buttons and form controls are affected.

* Update some more colors

* Update test snapshots

* Fix broken screenshot
  • Loading branch information
robintown authored Feb 13, 2024
1 parent ee50640 commit ed5ef02
Show file tree
Hide file tree
Showing 87 changed files with 104 additions and 99 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified playwright/snapshots/register/register.spec.ts/registration-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 13 additions & 14 deletions res/css/_common.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ legend {
border-radius: 8px;
font: var(--cpd-font-body-md-regular);
color: $button-fg-color;
background-color: $accent;
background-color: var(--cpd-color-bg-action-primary-rest);
width: auto;
padding: 7px;
padding-left: 1.5em;
Expand Down Expand Up @@ -594,8 +594,8 @@ legend {

/* flip colours for the secondary ones */
font-weight: var(--cpd-font-weight-semibold);
border: 1px solid currentColor;
color: $accent;
border: 1px solid var(--cpd-color-border-interactive-secondary);
color: var(--cpd-color-text-primary);
background-color: transparent;
font-family: inherit;
}
Expand All @@ -615,24 +615,25 @@ legend {
.mx_Dialog input[type="submit"].mx_Dialog_primary,
.mx_Dialog_buttons button.mx_Dialog_primary:not(.mx_Dialog_nonDialogButton):not(.mx_AccessibleButton),
.mx_Dialog_buttons input[type="submit"].mx_Dialog_primary {
color: $accent-fg-color;
background-color: $accent;
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-action-primary-rest);
border-color: var(--cpd-color-bg-action-primary-rest);
min-width: 156px;
}

.mx_Dialog button.danger:not(.mx_Dialog_nonDialogButton):not([class|="maplibregl"]),
.mx_Dialog input[type="submit"].danger,
.mx_Dialog_buttons button.danger:not(.mx_Dialog_nonDialogButton):not(.mx_AccessibleButton),
.mx_Dialog_buttons input[type="submit"].danger {
background-color: $alert;
border: solid 1px $alert;
color: $accent-fg-color;
background-color: var(--cpd-color-bg-critical-primary);
border: solid 1px var(--cpd-color-bg-critical-primary);
color: var(--cpd-color-text-on-solid-primary);
}

.mx_Dialog button.warning:not(.mx_Dialog_nonDialogButton):not([class|="maplibregl"]),
.mx_Dialog input[type="submit"].warning {
border: solid 1px $alert;
color: $alert;
border: solid 1px var(--cpd-color-border-critical-primary);
color: var(--cpd-color-text-critical-primary);
}

.mx_Dialog button:not(.mx_Dialog_nonDialogButton):not([class|="maplibregl"]):not(.mx_AccessibleButton):disabled,
Expand Down Expand Up @@ -814,11 +815,9 @@ legend {
}

@define-mixin composerButtonHighLight {
/* TODO: Refactor as this will break for apps that override the accent color */
background: var(--cpd-color-green-300);
/* make the icon the accent color too */
background: var(--cpd-color-bg-subtle-primary);
&::before {
background-color: $accent !important;
background-color: var(--cpd-color-icon-primary) !important;
}
}

Expand Down
12 changes: 6 additions & 6 deletions res/css/components/views/polls/_PollOption.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ limitations under the License.
.mx_PollOption_winnerIcon {
height: 12px;
width: 12px;
color: $accent;
color: var(--cpd-color-icon-accent-tertiary);
margin-right: $spacing-4;
vertical-align: middle;
}

.mx_PollOption_checked {
border-color: $accent;
border-color: var(--cpd-color-border-interactive-hovered);

.mx_PollOption_popularityBackground {
.mx_PollOption_popularityAmount {
background-color: $accent;
background-color: var(--cpd-color-icon-accent-tertiary);
}
}

/* override checked radio button styling to show checkmark instead */
.mx_StyledRadioButton_checked {
input[type="radio"] + div {
input[type="radio"]:checked + div {
border-width: 2px;
border-color: $accent;
background-color: $accent;
border-color: var(--cpd-color-icon-accent-tertiary);
background-color: var(--cpd-color-icon-accent-tertiary);
background-image: url("$(res)/img/element-icons/check-white.svg");
background-size: 12px;
background-repeat: no-repeat;
Expand Down
12 changes: 7 additions & 5 deletions res/css/structures/_SpaceRoomView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ limitations under the License.
}

&:hover {
border-color: $accent;
border-color: var(--cpd-color-bg-interactive-primary-rest);

&::before {
background-color: $accent;
background-color: var(--cpd-color-icon-primary);
}

> span {
Expand Down Expand Up @@ -212,7 +212,7 @@ limitations under the License.
left: 8px;
height: 16px;
width: 16px;
background: #fff; /* white icon fill */
background: var(--cpd-color-icon-on-solid-primary);
mask-size: 16px;
mask-image: url("$(res)/img/element-icons/room/invite.svg");
}
Expand Down Expand Up @@ -293,11 +293,13 @@ limitations under the License.
}

.mx_SpaceRoomView_inviteTeammates_inviteDialogButton {
color: $accent;
color: var(--cpd-color-text-primary);
font-weight: var(--cpd-font-weight-semibold);
text-decoration: underline;

&::before {
mask-image: url("$(res)/img/element-icons/room/invite.svg");
background-color: $accent;
background-color: var(--cpd-color-icon-primary);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions res/css/structures/_TabbedView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ limitations under the License.
}

.mx_TabbedView_tabLabel_active {
background-color: $accent;
color: $tab-label-active-fg-color;
background-color: var(--cpd-color-bg-action-primary-rest);
color: var(--cpd-color-text-on-solid-primary);
}

.mx_TabbedView_tabLabel_active .mx_TabbedView_maskedIcon::before {
background-color: $tab-label-active-fg-color;
background-color: var(--cpd-color-icon-on-solid-primary);
}

.mx_TabbedView_maskedIcon {
Expand Down
3 changes: 2 additions & 1 deletion res/css/views/dialogs/_CreateRoomDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ limitations under the License.
list-style: none;
font-weight: var(--cpd-font-weight-semibold);
cursor: pointer;
color: $accent;
color: var(--cpd-color-text-primary);
text-decoration: underline;
width: fit-content;

/* list-style doesn't do it for webkit */
Expand Down
3 changes: 1 addition & 2 deletions res/css/views/dialogs/_FeedbackDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ limitations under the License.

a,
.mx_AccessibleButton_kind_link {
color: $accent;
text-decoration: underline;
}

Expand Down Expand Up @@ -132,7 +131,7 @@ limitations under the License.

.mx_StyledRadioButton_checked {
font-size: 24px;
border-color: $accent;
border-color: var(--cpd-color-bg-action-primary-rest);
}

&::after {
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/dialogs/_SpaceSettingsDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ limitations under the License.

.mx_AccessibleButton_hasKind {
&.mx_AccessibleButton_kind_link {
font: var(--cpd-font-body-md-regular);
font: var(--cpd-font-body-md-semibold);
margin: 7px 18px;

&.mx_SettingsTab_showAdvanced {
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/dialogs/_SpotlightDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ limitations under the License.
left: $spacing-8;
width: 16px;
height: 16px;
background: $accent;
background: var(--cpd-color-icon-primary);
}
}
}
Expand Down
63 changes: 31 additions & 32 deletions res/css/views/elements/_AccessibleButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ limitations under the License.
display: inline-flex;
align-items: center;
justify-content: center;
font: var(--cpd-font-body-md-regular);
font: var(--cpd-font-body-md-semibold);
border: none; /* override default <button /> styles */
word-break: keep-all; /* prevent button text in Chinese/Japanese/Korean (CJK) from being collapsed */

Expand All @@ -53,29 +53,31 @@ limitations under the License.
}

&.mx_AccessibleButton_kind_primary_sm {
color: $button-primary-fg-color;
background-color: $accent;
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-action-primary-rest);
}

&.mx_AccessibleButton_kind_danger_sm {
color: $button-danger-fg-color;
background-color: $alert;
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-critical-primary);
}

&.mx_AccessibleButton_kind_link_sm {
color: $accent;
color: var(--cpd-color-text-primary);
text-decoration: underline;
font-weight: var(--cpd-font-weight-semibold);
}

&.mx_AccessibleButton_kind_confirm_sm {
background-color: $accent;
background-color: var(--cpd-color-bg-action-primary-rest);

&::before {
mask-image: url("$(res)/img/feather-customised/check.svg");
}
}

&.mx_AccessibleButton_kind_cancel_sm {
background-color: $alert;
background-color: var(--cpd-color-bg-critical-primary);

&::before {
mask-image: url("$(res)/img/feather-customised/x.svg");
Expand All @@ -99,57 +101,53 @@ limitations under the License.
font-weight: var(--cpd-font-weight-semibold);
}

&.mx_AccessibleButton_kind_icon_primary,
&.mx_AccessibleButton_kind_icon_primary_outline,
&.mx_AccessibleButton_kind_primary,
&.mx_AccessibleButton_kind_primary_outline {
border: 1px solid $accent;
}

&.mx_AccessibleButton_kind_icon_primary,
&.mx_AccessibleButton_kind_primary {
color: $button-primary-fg-color;
background-color: $accent;
border: 1px solid var(--cpd-color-bg-action-primary-rest);
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-action-primary-rest);
}

&.mx_AccessibleButton_kind_icon_primary_outline,
&.mx_AccessibleButton_kind_primary_outline {
color: $accent;
border: 1px solid var(--cpd-color-border-interactive-secondary);
color: var(--cpd-color-text-primary);
}

&.mx_AccessibleButton_kind_secondary {
color: $accent;
color: var(--cpd-color-text-primary);
text-decoration: underline;
}

&.mx_AccessibleButton_kind_secondary_content {
color: $secondary-content;
}

&.mx_AccessibleButton_kind_danger {
color: $button-danger-fg-color;
background-color: $alert;
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-critical-primary);

&.mx_AccessibleButton_disabled {
color: $button-danger-disabled-fg-color;
background-color: $button-danger-disabled-bg-color;
color: var(--cpd-color-text-on-solid-primary);
background-color: var(--cpd-color-bg-critical-primary);
}
}

&.mx_AccessibleButton_kind_danger_outline {
color: $alert;
color: var(--cpd-color-text-critical-primary);
background-color: transparent;
border: 1px solid $alert;
border: 1px solid var(--cpd-color-border-critical-primary);

&.mx_AccessibleButton_disabled {
color: $button-danger-disabled-bg-color;
border-color: $button-danger-disabled-bg-color;
color: var(--cpd-color-text-disabled);
border-color: var(--cpd-color-border-disabled);
}
}

&.mx_AccessibleButton_kind_danger_sm {
&.mx_AccessibleButton_disabled {
color: $button-danger-disabled-fg-color;
background-color: $button-danger-disabled-bg-color;
color: var(--cpd-color-text-disabled);
background-color: var(--cpd-color-bg-subtle-primary);
}
}

Expand All @@ -158,18 +156,19 @@ limitations under the License.
&.mx_AccessibleButton_kind_danger_inline,
&.mx_AccessibleButton_kind_content_inline {
font-size: inherit;
font-weight: normal;
font-weight: var(--cpd-font-weight-semibold);
line-height: inherit;
padding: 0;
text-decoration: underline;
}

&.mx_AccessibleButton_kind_link,
&.mx_AccessibleButton_kind_link_inline {
color: $accent;
color: var(--cpd-color-text-primary);
}

&.mx_AccessibleButton_kind_danger_inline {
color: $alert;
color: var(--cpd-color-text-critical-primary);
}

&.mx_AccessibleButton_kind_content_inline {
Expand Down
4 changes: 2 additions & 2 deletions res/css/views/elements/_ProgressBar.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ progress.mx_ProgressBar {
width: 60px;
overflow: hidden;
appearance: none;
border: none;
border: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);

@mixin ProgressBarBorderRadius 6px;
@mixin ProgressBarColour $accent;
@mixin ProgressBarColour var(--cpd-color-icon-accent-tertiary);
@mixin ProgressBarBgColour $progressbar-bg-color;
::-webkit-progress-value {
transition: width 1s;
Expand Down
2 changes: 2 additions & 0 deletions res/css/views/elements/_ReplyChain.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ limitations under the License.
white-space: nowrap; /* Enforce 'In reply to' to be a single line */
color: $secondary-content;
transition: color ease 0.15s;
font-weight: var(--cpd-font-weight-normal);
text-decoration: inherit;

&:hover {
color: $primary-content;
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/elements/_Slider.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
background: none;
font-size: 1em; /* set base multiplier for em units applied later */

--active-color: $accent;
--active-color: var(--cpd-color-bg-action-primary-rest);
--selection-dot-size: 2.4em;

&:disabled {
Expand Down
Loading

0 comments on commit ed5ef02

Please sign in to comment.