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

custom theme refactor #7726

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions res/themes/dark-custom/css/dark-custom.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import "../../../../res/css/_font-sizes.scss";
@import "../../legacy-light/css/_paths.scss";
@import "../../legacy-light/css/_fonts.scss";
@import "../../legacy-light/css/_legacy-light.scss";
@import "../../legacy-common/css/_paths.scss";
@import "../../legacy-common/css/_fonts.scss";
@import "../../legacy-common/css/_legacy-default.scss";
@import "../../legacy-dark/css/_legacy-dark.scss";
@import "../../light-custom/css/_custom.scss";
@import "../../legacy-common/css/_legacy-custom.scss";
@import "../../legacy-common/css/_legacy-common.scss";
@import "../../../../res/css/_components.scss";
93 changes: 93 additions & 0 deletions res/themes/legacy-common/css/_legacy-common.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// typical text (dark-on-white in light skin)
$secondary-fg-color: $primary-fg-color;
$tertiary-fg-color: $primary-fg-color;

// used for dialog box text
$light-fg-color: $header-panel-text-secondary-color;

$selection-fg-color: $primary-bg-color;

$groupFilterPanel-bg-color: $base-color;
$inverted-bg-color: $groupFilterPanel-bg-color;

// used by AddressSelector
$selected-color: $secondary-accent-color;

$resend-button-divider-color: $input-darker-bg-color;

$roomheader-bg-color: $primary-bg-color;

// Legacy theme backports
$primary-content: $primary-fg-color;
$secondary-content: $secondary-fg-color;
$tertiary-content: $tertiary-fg-color;
$quinary-content: $quaternary-content;
$background: $primary-bg-color;
$panels: rgba($system, 0.9);
$panel-selected: rgba($panel-base, 0.3);
$panel-hover: rgba($panel-base, 0.1);
$panel-actions: $roomtile-selected-bg-color;
$space-nav: rgba($panel-base, 0.15);

$roomlist-filter-active-bg-color: $panel-actions;
$roomlist-header-color: $primary-fg-color;

$voipcall-plinth-color: $system;

$call-view-button-on-foreground: $secondary-content;
$call-view-button-on-background: $background;
$call-view-button-off-foreground: $background;
$call-view-button-off-background: $secondary-content;

$tooltip-timeline-bg-color: $groupFilterPanel-bg-color;

// pinned events indicator
$pinned-color: $tertiary-content;

$groupFilterPanel-divider-color: $tertiary-content;

// ***** Mixins! *****

@define-mixin mx_DialogButton {
/* align images in buttons (eg spinners) */
vertical-align: middle;
border: 0px;
border-radius: 8px;
font-family: $font-family;
font-size: $font-14px;
color: $button-fg-color;
background-color: $accent;
width: auto;
padding: 7px;
padding-left: 1.5em;
padding-right: 1.5em;
cursor: pointer;
display: inline-block;
outline: none;
}

@define-mixin mx_DialogButton_hover {
}

@define-mixin mx_DialogButton_danger {
background-color: $accent;
}

@define-mixin mx_DialogButton_small {
@mixin mx_DialogButton;
font-size: $font-15px;
padding: 0px 1.5em 0px 1.5em;
}

@define-mixin mx_DialogButton_secondary {
// flip colours for the secondary ones
font-weight: 600;
border: 1px solid $accent !important;
color: $accent;
background-color: $button-secondary-bg-color;
}

@define-mixin mx_Dialog_link {
color: $accent;
text-decoration: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,21 @@ limitations under the License.
$font-family: var(--font-family, $font-family);
$monospace-font-family: var(--font-family-monospace, $monospace-font-family);

// Colors from Figma Compound https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=559%3A741
$accent: var(--accent, $accent);
$alert: var(--alert, $alert);
$links: var(--links, $links);
$primary-content: var(--primary-content, $primary-content);
$secondary-content: var(--secondary-content, $secondary-content);
$tertiary-content: var(--tertiary-content, $tertiary-content);
Comment on lines -24 to -26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these and a bunch of others no longer changeable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secondary-content would be redefined by secondary-fg-color by both the light and dark theme:
https://github.com/matrix-org/matrix-react-sdk/pull/7726/files/21b8d90ca9cc4eb0e2b9332ccf70575d88fdcb19#diff-ddc2c6eb3509b80549b30df3977708adfc119bfcea6e9253f88133791998666bL94
https://github.com/matrix-org/matrix-react-sdk/pull/7726/files/21b8d90ca9cc4eb0e2b9332ccf70575d88fdcb19#diff-90861a924b357562176a919e52e7efbe2f21df686d105dd439fcf244c9d51108L147

Thus no matter what the user defined for secondary-content it would not be respected in the theme. Since secondary-content = $secondary-fg-color is common for both light and dark themes it was moved into the newly created legacy_common file, which holds higher level css variables.

Copy link
Contributor Author

@acxz acxz Feb 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tertiary-content has the same issue as secondary-content. Note a followup solution would be to clean up these variables are just duplicates are unnecessary but this PR focuses only on reordering the imports and keeping the same variables and behavior. Of course, this is just extra work if we want custom themes to be based off the current themes instead of the legacy themes, which is why I did not work on making the legacy themes as clean/streamlined as possible as I would rather do that for the newer themes. But fixing the import order is important for the current custom theming which is an issue I want to tackle and hence this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other variables the reasons are similar, if you really want I go through and doc the reason for each variable. However, I would rather spend my time working on getting custom themes updated for the new themes instead of focusing on this codebase which will be deleted shortly.

$quaternary-content: var(--quaternary-content, $quaternary-content);
$quinary-content: var(--quinary-content, $quinary-content);
$system: var(--system, $system);
$background: var(--background, $background);
$panels: rgba($system, 0.9);
$panel-base: var(--panel-base, $tertiary-content); // This color is not intended for use in the app
$panel-base: var(--panel-base, $panel-base); // This color is not intended for use in the app
$panel-selected: rgba($panel-base, 0.3);
$panel-hover: rgba($panel-base, 0.1);
$panel-actions: rgba($panel-base, 0.2);
$space-nav: rgba($panel-base, 0.1);

//
// --accent-color
$username-variant3-color: var(--accent-color);
//

// --timeline-background-color
$button-secondary-bg-color: var(--timeline-background-color);
$lightbox-border-color: var(--timeline-background-color);
Expand All @@ -50,15 +43,15 @@ $togglesw-off-color: var(--togglesw-off-color);
$droptarget-bg-color: var(--timeline-background-color-50pct); //still needs alpha at .5
$authpage-modal-bg-color: var(--timeline-background-color-50pct); //still needs alpha at .59
$roomheader-bg-color: var(--timeline-background-color);
//

// --roomlist-highlights-color
$panel-actions: var(--roomlist-highlights-color);
//

// --sidebar-color
$groupFilterPanel-bg-color: var(--sidebar-color);
$tooltip-timeline-bg-color: var(--sidebar-color);
$dialog-backdrop-color: var(--sidebar-color-50pct);
//

// --roomlist-background-color
$header-panel-bg-color: var(--roomlist-background-color);
$panel-gradient: var(--roomlist-background-color-0pct), var(--roomlist-background-color);
Expand All @@ -69,7 +62,7 @@ $secondary-accent-color: var(--roomlist-background-color);
$selected-color: var(--roomlist-background-color);
$widget-menu-bar-bg-color: var(--roomlist-background-color);
$roomlist-bg-color: var(--roomlist-background-color);
//

// --timeline-text-color
$message-action-bar-fg-color: var(--timeline-text-color);
$primary-content: var(--timeline-text-color);
Expand All @@ -88,11 +81,10 @@ $authpage-primary-color: var(--timeline-text-color);
// --roomlist-text-secondary-color
$roomtile-default-badge-bg-color: var(--roomlist-text-secondary-color);

//
// --roomlist-separator-color
$input-darker-bg-color: var(--roomlist-separator-color);
$primary-hairline-color: var(--roomlist-separator-color);// originally #e5e5e5, but close enough
//

// --timeline-text-secondary-color
$authpage-secondary-color: var(--timeline-text-secondary-color);
$pinned-color: var(--timeline-text-secondary-color);
Expand All @@ -107,13 +99,13 @@ $rte-room-pill-color: $room-highlight-color;

// was #888888
$info-plinth-fg-color: var(--timeline-text-secondary-color);
//

// --primary-color
$accent-alt: var(--primary-color);
//

// --warning-color
$button-danger-disabled-bg-color: var(--warning-color-50pct); // still needs alpha at 0.5
//

// --username colors (which use a 0-based index)
$username-variant1-color: var(--username-colors_0, $username-variant1-color);
$username-variant2-color: var(--username-colors_1, $username-variant2-color);
Expand All @@ -123,11 +115,11 @@ $username-variant5-color: var(--username-colors_4, $username-variant5-color);
$username-variant6-color: var(--username-colors_5, $username-variant6-color);
$username-variant7-color: var(--username-colors_6, $username-variant7-color);
$username-variant8-color: var(--username-colors_7, $username-variant8-color);
//

// --timeline-highlights-color
$event-selected-color: var(--timeline-highlights-color);
$event-highlight-bg-color: var(--timeline-highlights-color);
//

// redirect some variables away from their hardcoded values in the light theme
$settings-grey-fg-color: $primary-content;

Expand Down
127 changes: 127 additions & 0 deletions res/themes/legacy-common/css/_legacy-default.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// XXX: check this?
/* Nunito lacks combining diacritics, so these will fall through
to the next font. Helevetica's diacritics however do not combine
nicely (on OSX, at least) and result in a huge horizontal mess.
Arial empirically gets it right, hence prioritising Arial here. */
/* We fall through to Twemoji for emoji rather than falling through
to native Emoji fonts (if any) to ensure cross-browser consistency */
/* Noto Color Emoji contains digits, in fixed-width, therefore causing
digits in flowed text to stand out.
TODO: Consider putting all emoji fonts to the end rather than the front. */
$font-family: 'Nunito', 'Twemoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Arial', 'Helvetica', sans-serif, 'Noto Color Emoji';

$monospace-font-family: 'Inconsolata', 'Twemoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Courier', monospace, 'Noto Color Emoji';

// button UI (white-on-green in light skin)
$accent-fg-color: #ffffff;
$accent-alt: #238cf5;

$focus-brightness: 105%;
$location-marker-color: #ffffff;

// informational plinth
$info-plinth-fg-color: #888;

// used by RoomDropTarget
$droptarget-bg-color: rgba(255, 255, 255, 0.5);

// used for the border of input text fields
$input-border-color: #e7e7e7;

$button-fg-color: white;

// apart from login forms, which have stronger border
$strong-input-border-color: #c7c7c7;

// used for UserSettings EditableText
$input-underline-color: rgba(151, 151, 151, 0.5);
$input-fg-color: rgba(74, 74, 74, 0.9);

$avatar-initial-color: #ffffff;

$dialog-shadow-color: rgba(0, 0, 0, 0.48);

$lightbox-background-bg-color: #000;

$imagebody-giflabel: rgba(0, 0, 0, 0.7);
$imagebody-giflabel-border: rgba(0, 0, 0, 0.2);
$imagebody-giflabel-color: rgba(255, 255, 255, 1);

$info-plinth-fg-color: #888;

$neutral-badge-color: #dbdbdb;

$preview-widget-bar-color: #ddd;

$blockquote-bar-color: #ddd;

$settings-grey-fg-color: #a2a2a2;
$settings-profile-button-bg-color: #e7e7e7;

$rte-bg-color: #e9e9e9;
$rte-code-bg-color: rgba(0, 0, 0, 0.04);

$theme-button-bg-color: #e3e8f0;

$presence-away: #d9b072;
$presence-offline: #e3e8f0;

// Legacy theme backports
$accent: #0DBD8B;
$alert: #FF5B55;
$links: #0086e6;
$quaternary-content: #6F7882;

$username-variant1-color: #368bd6;
$username-variant2-color: #ac3ba8;
$username-variant3-color: #03b381;
$username-variant4-color: #e64f7a;
$username-variant5-color: #ff812d;
$username-variant6-color: #2dc2c5;
$username-variant7-color: #5c56f5;
$username-variant8-color: #74d12c;

$yellow-background: #fff8e3;

$copy-button-url: "$(res)/img/feather-customised/clipboard.svg";

// e2e
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent
$e2e-unknown-color: #e8bf37;
$e2e-unverified-color: #e8bf37;
$e2e-warning-color: #ba6363;

// ImageView
$lightbox-bg-color: #454545;
$lightbox-fg-color: #ffffff;
$lightbox-border-color: #ffffff;

// Buttons
$button-primary-fg-color: #ffffff;
$button-danger-fg-color: #ffffff;
$button-danger-disabled-fg-color: #ffffff;
$button-danger-disabled-bg-color: #f5b6bb; // TODO: Verify color

// Toggle switch
$togglesw-ball-color: #fff;

// Slider
$slider-background-color: #c1c9d6;

$authpage-bg-color: #2e3649;
$authpage-modal-bg-color: rgba(255, 255, 255, 0.59);
$authpage-focus-bg-color: #dddddd;
$authpage-lang-color: #4e5054;
$authpage-primary-color: #232f32;
$authpage-secondary-color: #61708b;

$tooltip-timeline-fg-color: #ffffff;

// See non-legacy _light for variable information
$voice-record-stop-symbol-color: #ff4b55;
$voice-record-live-circle-color: #ff4b55;

$composer-shadow-color: tranparent;

// Bubble tiles
$eventbubble-reply-color: #C1C6CD;
Loading