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

Commit

Permalink
Compound color pass (#11079)
Browse files Browse the repository at this point in the history
* Integrate compound design tokens

The icons should not be included in this repo, and should live in the compound design token repo, but for simplicity sake at this phase of the integration they will be added here

* Pareto color pass on the light theme

* bugfixes in the light color pass

* Compound color pass dark theme

* Compound color pass high contrast

* Fix typo

* fix tooltip

* Fix PR feedback

* fix composer button mixin

* Normalise some of the auth page colors

* Update based on figma feedback

* lintfix

* regenerate theme index

* Fix cypress tests

Removed the CSS assertions in the room header as it overlaps with the Percy snapshot

* fix more e2e tests

* update colors based on feedback

* fix color pass

* Fix theme overrides

* Restore -transparent

* fix color mapping

* Final colour pass update

* Do not consume compound colors directly

* rethemedex

* Update pass

* Final tweaks

* a11y pass

* scope opacity to checkbox and not label

* Add missing customisations var for theming

* lintfix

* remove unwanted test
  • Loading branch information
Germain authored Jul 12, 2023
1 parent db52cdd commit 38d24f1
Show file tree
Hide file tree
Showing 54 changed files with 399 additions and 301 deletions.
12 changes: 1 addition & 11 deletions cypress/e2e/room/room-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,7 @@ describe("Room Header", () => {
const buttonsHighlighted = ["Threads", "Notifications", "Room info"];

for (const name of buttonsHighlighted) {
cy.findByRole("button", { name: name })
.click() // Highlight the button
.then(($btn) => {
// Note it is not possible to get CSS values of a pseudo class with "have.css".
const color = $btn[0].ownerDocument.defaultView // get window reference from element
.getComputedStyle($btn[0], "before") // get the pseudo selector
.getPropertyValue("background-color"); // get "background-color" value

// Assert the value is equal to $accent == hex #0dbd8b == rgba(13, 189, 139)
expect(color).to.eq("rgb(13, 189, 139)");
});
cy.findByRole("button", { name: name }).click(); // Highlight the button
}
});

Expand Down
27 changes: 0 additions & 27 deletions cypress/e2e/settings/appearance-user-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,32 +299,5 @@ describe("Appearance user settings tab", () => {
cy.findByLabelText("Use high contrast").should("not.exist");
},
);

it("should support enabling the high contast theme", () => {
cy.createRoom({ name: "Test Room" }).viewRoomByName("Test Room");

cy.get(".mx_GenericEventListSummary").within(() => {
// Assert that $primary-content is applied to GELS summary on the light theme
// $primary-content on the light theme = #17191c = rgb(23, 25, 28)
cy.get(".mx_TextualEvent.mx_GenericEventListSummary_summary")
.should("have.css", "color", "rgb(23, 25, 28)")
.should("have.css", "opacity", "0.5");
});

cy.openUserSettings("Appearance")
.findByTestId("mx_ThemeChoicePanel")
.findByLabelText("Use high contrast")
.click({ force: true }); // force click because the size of the checkbox is zero

cy.closeDialog();

cy.get(".mx_GenericEventListSummary").within(() => {
// Assert that $secondary-content is specified for GELS summary on the high contrast theme
// $secondary-content on the high contrast theme = #5e6266 = rgb(94, 98, 102)
cy.get(".mx_TextualEvent.mx_GenericEventListSummary_summary")
.should("have.css", "color", "rgb(94, 98, 102)")
.should("have.css", "opacity", "1");
});
});
});
});
20 changes: 0 additions & 20 deletions cypress/e2e/threads/threads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ describe("Threads", () => {
"Hello there. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt " +
"ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi";

// --MessageTimestamp-color = #acacac = rgb(172, 172, 172)
// See: _MessageTimestamp.pcss
const MessageTimestampColor = "rgb(172, 172, 172)";
const ThreadViewGroupSpacingStart = "56px"; // --ThreadView_group_spacing-start
// Exclude timestamp and read marker from snapshots
const percyCSS = ".mx_MessageTimestamp, .mx_MessagePanel_myReadMarker { visibility: hidden !important; }";
Expand All @@ -75,13 +72,6 @@ describe("Threads", () => {
// User sends message
cy.findByRole("textbox", { name: "Send a message…" }).type("Hello Mr. Bot{enter}");

// Check the colour of timestamp on the main timeline
cy.get(".mx_EventTile_last .mx_EventTile_line .mx_MessageTimestamp").should(
"have.css",
"color",
MessageTimestampColor,
);

// Wait for message to send, get its ID and save as @threadId
cy.contains(".mx_EventTile[data-scroll-tokens]", "Hello Mr. Bot")
.invoke("attr", "data-scroll-tokens")
Expand Down Expand Up @@ -151,13 +141,6 @@ describe("Threads", () => {
cy.get(".mx_ThreadView").within(() => {
// User responds in thread
cy.findByRole("textbox", { name: "Send a message…" }).type("Test{enter}");

// Check the colour of timestamp on EventTile in a thread (mx_ThreadView)
cy.get(".mx_EventTile_last[data-layout='group'] .mx_EventTile_line .mx_MessageTimestamp").should(
"have.css",
"color",
MessageTimestampColor,
);
});

// User asserts summary was updated correctly
Expand Down Expand Up @@ -307,9 +290,6 @@ describe("Threads", () => {
// Check the number of the replies
cy.get(".mx_ThreadPanel_replies_amount").findByText("2").should("exist");

// Check the colour of timestamp on thread list
cy.get(".mx_EventTile_details .mx_MessageTimestamp").should("have.css", "color", MessageTimestampColor);

// Make sure the notification dot is visible
cy.get(".mx_NotificationBadge_visible").should("be.visible");

Expand Down
18 changes: 10 additions & 8 deletions res/css/_common.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ legend {
background-color: transparent;
color: $input-darker-fg-color;
border-radius: 4px;
border: 1px solid rgba($primary-content, 0.1);
border: 1px solid $secondary-hairline-color;
/* these things should probably not be defined globally */
margin: 9px;
}
Expand All @@ -263,7 +263,7 @@ legend {
:not(.mx_textinput):not(.mx_Field):not(.mx_no_textinput) > input[type="text"]::placeholder,
:not(.mx_textinput):not(.mx_Field):not(.mx_no_textinput) > input[type="search"]::placeholder,
.mx_textinput input::placeholder {
color: rgba($input-darker-fg-color, 0.75);
color: $input-placeholder;
}
}

Expand Down Expand Up @@ -584,9 +584,9 @@ legend {

/* flip colours for the secondary ones */
font-weight: var(--cpd-font-weight-semibold);
border: 1px solid $accent;
border: 1px solid currentColor;
color: $accent;
background-color: $button-secondary-bg-color;
background-color: transparent;
font-family: inherit;
}

Expand Down Expand Up @@ -808,18 +808,19 @@ legend {
mask-size: contain;
height: 18px;
min-width: 18px;
background-color: $secondary-content !important;
background-color: $icon-button-color !important;
}

@define-mixin composerButtonHighLight {
background: rgba($accent, 0.25);
/* 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 */
&::before {
background-color: $accent !important;
}
}

@define-mixin composerButton $border-radius, $hover-color {
@define-mixin composerButton $border-radius, $hover-color, $hover-bg {
--size: 26px;
position: relative;
cursor: pointer;
Expand All @@ -840,6 +841,7 @@ legend {
mask-repeat: no-repeat;
mask-size: contain;
mask-position: center;
z-index: 2;
}

&::after {
Expand All @@ -855,7 +857,7 @@ legend {

&:hover {
&::after {
background: rgba($hover-color, 0.1);
background: $hover-bg;
}

&::before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ limitations under the License.

.mx_KebabContextMenu_icon {
width: 24px;
color: $secondary-content;
color: $icon-button-color;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
background: transparent;

border-radius: 4px;
color: $secondary-content;
color: $icon-button-color;

--icon-transform: rotate(-90deg);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ limitations under the License.

&.Inactive {
--icon-color: $secondary-content;
--background-color: $system;
--background-color: $panels;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.
}

.mx_DeviceTypeIcon_deviceIconWrapper {
--background-color: $system;
--background-color: $panels;
--icon-color: $secondary-content;

height: 40px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
padding: 0 $spacing-16;
margin-bottom: $spacing-32;

background-color: $system;
background-color: $panels;
border-radius: 8px;
color: $secondary-content;
}
Expand Down
2 changes: 1 addition & 1 deletion res/css/compound/_Icon.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
}

.mx_Icon_bg-accent-light {
background-color: rgba($accent, 0.1);
background-color: $accent-300;
}

.mx_Icon_alert {
Expand Down
3 changes: 2 additions & 1 deletion res/css/structures/_FilePanel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ limitations under the License.

.mx_MessageTimestamp {
text-align: right;
font: var(--cpd-font-body-md-regular);
color: $secondary-content;
font: var(--cpd-font-body-sm-regular);
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions res/css/structures/_LeftPanel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_MatrixChat--with-avatar {
.mx_LeftPanel,
.mx_LeftPanel .mx_LeftPanel_roomListContainer {
background-color: transparent;
}
}

.mx_LeftPanel_outerWrapper {
display: flex;
flex-direction: column;
Expand Down
4 changes: 2 additions & 2 deletions res/css/structures/_RoomView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ limitations under the License.
height: var(--RoomHeader-indicator-dot-size);
border-radius: 50%;
transform: scale(1);
background: rgba(var(--RoomHeader-indicator-pulseColor), 1);
box-shadow: 0 0 0 0 rgba(var(--RoomHeader-indicator-pulseColor), 1);
background: var(--RoomHeader-indicator-pulseColor);
box-shadow: 0 0 0 0 var(--RoomHeader-indicator-pulseColor);
animation: mx_Indicator_pulse 2s infinite;
animation-iteration-count: 1;

Expand Down
2 changes: 1 addition & 1 deletion res/css/structures/_SpacePanel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ limitations under the License.

.mx_UserMenu {
padding: 0 2px 8px;
border-bottom: 1px solid $quinary-content;
border-bottom: 1px solid $separator;
margin: 12px 14px 4px 18px;
max-width: 226px;
}
Expand Down
2 changes: 1 addition & 1 deletion res/css/structures/_UserMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ limitations under the License.
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background: $primary-content;
background: $icon-button-color;
}
}

Expand Down
2 changes: 1 addition & 1 deletion res/css/views/beta/_BetaCard.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

.mx_BetaCard {
padding: $spacing-24;
background-color: $system;
background-color: $panels;
border-radius: 8px;
box-sizing: border-box;
color: $secondary-content;
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/context_menus/_IconizedContextMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ limitations under the License.
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background-color: $secondary-content;
background-color: $icon-button-color;
}
}

Expand Down
2 changes: 1 addition & 1 deletion res/css/views/context_menus/_MessageContextMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background: $primary-content;
background: $icon-button-color;
}
}

Expand Down
2 changes: 1 addition & 1 deletion res/css/views/dialogs/_PollCreateDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
.mx_PollCreateDialog_busy {
position: absolute;
inset: 0;
background-color: rgba($background, 0.6);
background-color: $overlay-background;
z-index: 1;
}

Expand Down
1 change: 0 additions & 1 deletion res/css/views/elements/_AccessibleButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ limitations under the License.

&.mx_AccessibleButton_kind_primary_outline {
color: $accent;
background-color: $button-secondary-bg-color;
}

&.mx_AccessibleButton_kind_secondary {
Expand Down
2 changes: 2 additions & 0 deletions res/css/views/elements/_GenericEventListSummary.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ limitations under the License.
/* Make all state events one order smaller than the other events */
.mx_EventTile {
font: var(--cpd-font-body-sm-regular);
color: $secondary-content;
}
}

Expand All @@ -121,6 +122,7 @@ limitations under the License.
.mx_TextualEvent.mx_GenericEventListSummary_summary {
font: var(--cpd-font-body-sm-regular);
display: inline-flex;
color: $secondary-content;
}

.mx_GenericEventListSummary_avatars {
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/elements/_SSOButtons.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ limitations under the License.
}

.mx_SSOButton:hover {
background-color: $panel-hover;
background-color: $panel-actions;
}

.mx_SSOButton_default {
Expand Down
8 changes: 5 additions & 3 deletions res/css/views/elements/_StyledCheckbox.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ limitations under the License.
height: $size;
width: $size;
size: 0.5rem;

border: 1px solid rgba($muted-fg-color, 0.5);
border: 1px solid $strong-input-border-color;
box-sizing: border-box;
border-radius: $border-radius;

Expand All @@ -68,7 +67,6 @@ limitations under the License.
}

&:disabled + label {
opacity: 0.5;
cursor: not-allowed;
}

Expand All @@ -89,6 +87,10 @@ limitations under the License.
background: $accent;
border-color: $accent;
}

&:checked:disabled + label > .mx_Checkbox_background {
opacity: 0.5;
}
}

.mx_Checkbox.mx_Checkbox_kind_outline input[type="checkbox"] {
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/elements/_StyledRadioButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
*/

.mx_StyledRadioButton {
$radio-circle-color: $quaternary-content;
$radio-circle-color: $strong-input-border-color;
$active-radio-circle-color: $accent;
position: relative;

Expand Down
Loading

0 comments on commit 38d24f1

Please sign in to comment.