Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ed5ef02

Browse files
authored
Use Compound primary colors for most actions (#12241)
* 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
1 parent ee50640 commit ed5ef02

File tree

87 files changed

+104
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+104
-99
lines changed

res/css/_common.pcss

+13-14
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ legend {
561561
border-radius: 8px;
562562
font: var(--cpd-font-body-md-regular);
563563
color: $button-fg-color;
564-
background-color: $accent;
564+
background-color: var(--cpd-color-bg-action-primary-rest);
565565
width: auto;
566566
padding: 7px;
567567
padding-left: 1.5em;
@@ -594,8 +594,8 @@ legend {
594594

595595
/* flip colours for the secondary ones */
596596
font-weight: var(--cpd-font-weight-semibold);
597-
border: 1px solid currentColor;
598-
color: $accent;
597+
border: 1px solid var(--cpd-color-border-interactive-secondary);
598+
color: var(--cpd-color-text-primary);
599599
background-color: transparent;
600600
font-family: inherit;
601601
}
@@ -615,24 +615,25 @@ legend {
615615
.mx_Dialog input[type="submit"].mx_Dialog_primary,
616616
.mx_Dialog_buttons button.mx_Dialog_primary:not(.mx_Dialog_nonDialogButton):not(.mx_AccessibleButton),
617617
.mx_Dialog_buttons input[type="submit"].mx_Dialog_primary {
618-
color: $accent-fg-color;
619-
background-color: $accent;
618+
color: var(--cpd-color-text-on-solid-primary);
619+
background-color: var(--cpd-color-bg-action-primary-rest);
620+
border-color: var(--cpd-color-bg-action-primary-rest);
620621
min-width: 156px;
621622
}
622623

623624
.mx_Dialog button.danger:not(.mx_Dialog_nonDialogButton):not([class|="maplibregl"]),
624625
.mx_Dialog input[type="submit"].danger,
625626
.mx_Dialog_buttons button.danger:not(.mx_Dialog_nonDialogButton):not(.mx_AccessibleButton),
626627
.mx_Dialog_buttons input[type="submit"].danger {
627-
background-color: $alert;
628-
border: solid 1px $alert;
629-
color: $accent-fg-color;
628+
background-color: var(--cpd-color-bg-critical-primary);
629+
border: solid 1px var(--cpd-color-bg-critical-primary);
630+
color: var(--cpd-color-text-on-solid-primary);
630631
}
631632

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

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

816817
@define-mixin composerButtonHighLight {
817-
/* TODO: Refactor as this will break for apps that override the accent color */
818-
background: var(--cpd-color-green-300);
819-
/* make the icon the accent color too */
818+
background: var(--cpd-color-bg-subtle-primary);
820819
&::before {
821-
background-color: $accent !important;
820+
background-color: var(--cpd-color-icon-primary) !important;
822821
}
823822
}
824823

res/css/components/views/polls/_PollOption.pcss

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,26 @@ limitations under the License.
5252
.mx_PollOption_winnerIcon {
5353
height: 12px;
5454
width: 12px;
55-
color: $accent;
55+
color: var(--cpd-color-icon-accent-tertiary);
5656
margin-right: $spacing-4;
5757
vertical-align: middle;
5858
}
5959

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

6363
.mx_PollOption_popularityBackground {
6464
.mx_PollOption_popularityAmount {
65-
background-color: $accent;
65+
background-color: var(--cpd-color-icon-accent-tertiary);
6666
}
6767
}
6868

6969
/* override checked radio button styling to show checkmark instead */
7070
.mx_StyledRadioButton_checked {
71-
input[type="radio"] + div {
71+
input[type="radio"]:checked + div {
7272
border-width: 2px;
73-
border-color: $accent;
74-
background-color: $accent;
73+
border-color: var(--cpd-color-icon-accent-tertiary);
74+
background-color: var(--cpd-color-icon-accent-tertiary);
7575
background-image: url("$(res)/img/element-icons/check-white.svg");
7676
background-size: 12px;
7777
background-repeat: no-repeat;

res/css/structures/_SpaceRoomView.pcss

+7-5
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ limitations under the License.
4646
}
4747

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

5151
&::before {
52-
background-color: $accent;
52+
background-color: var(--cpd-color-icon-primary);
5353
}
5454

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

295295
.mx_SpaceRoomView_inviteTeammates_inviteDialogButton {
296-
color: $accent;
296+
color: var(--cpd-color-text-primary);
297+
font-weight: var(--cpd-font-weight-semibold);
298+
text-decoration: underline;
297299

298300
&::before {
299301
mask-image: url("$(res)/img/element-icons/room/invite.svg");
300-
background-color: $accent;
302+
background-color: var(--cpd-color-icon-primary);
301303
}
302304
}
303305
}

res/css/structures/_TabbedView.pcss

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ limitations under the License.
4343
}
4444

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

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

5454
.mx_TabbedView_maskedIcon {

res/css/views/dialogs/_CreateRoomDialog.pcss

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ limitations under the License.
2121
list-style: none;
2222
font-weight: var(--cpd-font-weight-semibold);
2323
cursor: pointer;
24-
color: $accent;
24+
color: var(--cpd-color-text-primary);
25+
text-decoration: underline;
2526
width: fit-content;
2627

2728
/* list-style doesn't do it for webkit */

res/css/views/dialogs/_FeedbackDialog.pcss

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ limitations under the License.
6060

6161
a,
6262
.mx_AccessibleButton_kind_link {
63-
color: $accent;
6463
text-decoration: underline;
6564
}
6665

@@ -132,7 +131,7 @@ limitations under the License.
132131

133132
.mx_StyledRadioButton_checked {
134133
font-size: 24px;
135-
border-color: $accent;
134+
border-color: var(--cpd-color-bg-action-primary-rest);
136135
}
137136

138137
&::after {

res/css/views/dialogs/_SpaceSettingsDialog.pcss

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ limitations under the License.
7171

7272
.mx_AccessibleButton_hasKind {
7373
&.mx_AccessibleButton_kind_link {
74-
font: var(--cpd-font-body-md-regular);
74+
font: var(--cpd-font-body-md-semibold);
7575
margin: 7px 18px;
7676

7777
&.mx_SettingsTab_showAdvanced {

res/css/views/dialogs/_SpotlightDialog.pcss

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ limitations under the License.
396396
left: $spacing-8;
397397
width: 16px;
398398
height: 16px;
399-
background: $accent;
399+
background: var(--cpd-color-icon-primary);
400400
}
401401
}
402402
}

res/css/views/elements/_AccessibleButton.pcss

+31-32
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ limitations under the License.
4242
display: inline-flex;
4343
align-items: center;
4444
justify-content: center;
45-
font: var(--cpd-font-body-md-regular);
45+
font: var(--cpd-font-body-md-semibold);
4646
border: none; /* override default <button /> styles */
4747
word-break: keep-all; /* prevent button text in Chinese/Japanese/Korean (CJK) from being collapsed */
4848

@@ -53,29 +53,31 @@ limitations under the License.
5353
}
5454

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

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

6565
&.mx_AccessibleButton_kind_link_sm {
66-
color: $accent;
66+
color: var(--cpd-color-text-primary);
67+
text-decoration: underline;
68+
font-weight: var(--cpd-font-weight-semibold);
6769
}
6870

6971
&.mx_AccessibleButton_kind_confirm_sm {
70-
background-color: $accent;
72+
background-color: var(--cpd-color-bg-action-primary-rest);
7173

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

7779
&.mx_AccessibleButton_kind_cancel_sm {
78-
background-color: $alert;
80+
background-color: var(--cpd-color-bg-critical-primary);
7981

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

102-
&.mx_AccessibleButton_kind_icon_primary,
103-
&.mx_AccessibleButton_kind_icon_primary_outline,
104-
&.mx_AccessibleButton_kind_primary,
105-
&.mx_AccessibleButton_kind_primary_outline {
106-
border: 1px solid $accent;
107-
}
108-
109104
&.mx_AccessibleButton_kind_icon_primary,
110105
&.mx_AccessibleButton_kind_primary {
111-
color: $button-primary-fg-color;
112-
background-color: $accent;
106+
border: 1px solid var(--cpd-color-bg-action-primary-rest);
107+
color: var(--cpd-color-text-on-solid-primary);
108+
background-color: var(--cpd-color-bg-action-primary-rest);
113109
}
114110

115111
&.mx_AccessibleButton_kind_icon_primary_outline,
116112
&.mx_AccessibleButton_kind_primary_outline {
117-
color: $accent;
113+
border: 1px solid var(--cpd-color-border-interactive-secondary);
114+
color: var(--cpd-color-text-primary);
118115
}
119116

120117
&.mx_AccessibleButton_kind_secondary {
121-
color: $accent;
118+
color: var(--cpd-color-text-primary);
119+
text-decoration: underline;
122120
}
123121

124122
&.mx_AccessibleButton_kind_secondary_content {
125123
color: $secondary-content;
126124
}
127125

128126
&.mx_AccessibleButton_kind_danger {
129-
color: $button-danger-fg-color;
130-
background-color: $alert;
127+
color: var(--cpd-color-text-on-solid-primary);
128+
background-color: var(--cpd-color-bg-critical-primary);
131129

132130
&.mx_AccessibleButton_disabled {
133-
color: $button-danger-disabled-fg-color;
134-
background-color: $button-danger-disabled-bg-color;
131+
color: var(--cpd-color-text-on-solid-primary);
132+
background-color: var(--cpd-color-bg-critical-primary);
135133
}
136134
}
137135

138136
&.mx_AccessibleButton_kind_danger_outline {
139-
color: $alert;
137+
color: var(--cpd-color-text-critical-primary);
140138
background-color: transparent;
141-
border: 1px solid $alert;
139+
border: 1px solid var(--cpd-color-border-critical-primary);
142140

143141
&.mx_AccessibleButton_disabled {
144-
color: $button-danger-disabled-bg-color;
145-
border-color: $button-danger-disabled-bg-color;
142+
color: var(--cpd-color-text-disabled);
143+
border-color: var(--cpd-color-border-disabled);
146144
}
147145
}
148146

149147
&.mx_AccessibleButton_kind_danger_sm {
150148
&.mx_AccessibleButton_disabled {
151-
color: $button-danger-disabled-fg-color;
152-
background-color: $button-danger-disabled-bg-color;
149+
color: var(--cpd-color-text-disabled);
150+
background-color: var(--cpd-color-bg-subtle-primary);
153151
}
154152
}
155153

@@ -158,18 +156,19 @@ limitations under the License.
158156
&.mx_AccessibleButton_kind_danger_inline,
159157
&.mx_AccessibleButton_kind_content_inline {
160158
font-size: inherit;
161-
font-weight: normal;
159+
font-weight: var(--cpd-font-weight-semibold);
162160
line-height: inherit;
163161
padding: 0;
162+
text-decoration: underline;
164163
}
165164

166165
&.mx_AccessibleButton_kind_link,
167166
&.mx_AccessibleButton_kind_link_inline {
168-
color: $accent;
167+
color: var(--cpd-color-text-primary);
169168
}
170169

171170
&.mx_AccessibleButton_kind_danger_inline {
172-
color: $alert;
171+
color: var(--cpd-color-text-critical-primary);
173172
}
174173

175174
&.mx_AccessibleButton_kind_content_inline {

res/css/views/elements/_ProgressBar.pcss

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ progress.mx_ProgressBar {
1919
width: 60px;
2020
overflow: hidden;
2121
appearance: none;
22-
border: none;
22+
border: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
2323

2424
@mixin ProgressBarBorderRadius 6px;
25-
@mixin ProgressBarColour $accent;
25+
@mixin ProgressBarColour var(--cpd-color-icon-accent-tertiary);
2626
@mixin ProgressBarBgColour $progressbar-bg-color;
2727
::-webkit-progress-value {
2828
transition: width 1s;

res/css/views/elements/_ReplyChain.pcss

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ limitations under the License.
2525
white-space: nowrap; /* Enforce 'In reply to' to be a single line */
2626
color: $secondary-content;
2727
transition: color ease 0.15s;
28+
font-weight: var(--cpd-font-weight-normal);
29+
text-decoration: inherit;
2830

2931
&:hover {
3032
color: $primary-content;

res/css/views/elements/_Slider.pcss

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ limitations under the License.
2626
background: none;
2727
font-size: 1em; /* set base multiplier for em units applied later */
2828

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

3232
&:disabled {

0 commit comments

Comments
 (0)