Skip to content

Commit

Permalink
Disable unneeded selection; Dark theme color fixes (#1483)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajaxy committed Oct 8, 2021
1 parent c2f3c79 commit 1abb31e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/common/Avatar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
font-weight: bold;
display: flex;
white-space: nowrap;
user-select: none;

img:not(.emoji) {
border-radius: 50%;
Expand Down
1 change: 1 addition & 0 deletions src/components/middle/MessageList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
.ActionMessage,
.empty {
text-align: center;
user-select: none;

> span {
display: inline-block;
Expand Down
1 change: 1 addition & 0 deletions src/components/middle/message/CommentButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
white-space: nowrap;
cursor: pointer;
transition: background-color .15s, color .15s;
user-select: none;

body.animation-level-0 & {
transition: none !important;
Expand Down
1 change: 1 addition & 0 deletions src/components/middle/message/MessageMeta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
color: white;
cursor: pointer;
max-width: 100%;
user-select: none;

.message-time,
.message-signature,
Expand Down
1 change: 1 addition & 0 deletions src/components/middle/message/_message-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@
padding: 0 .375rem;
border-radius: .75rem;
line-height: 1.125rem;
user-select: none;
}

.message-media-duration .icon-muted-chat {
Expand Down
2 changes: 0 additions & 2 deletions src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ $color-user-8: #faa774;
--color-background-secondary-accent: #E4E4E5;
--color-background-own: #{$color-light-green};
--color-background-own-selected: #{darken($color-light-green, 10%)};
--color-background-own-rgb: #{toRGB($color-light-green)};
--color-text: #{$color-black};
--color-text-lighter: #{$color-dark-gray};
--color-text-secondary: #{$color-text-secondary};
Expand All @@ -86,7 +85,6 @@ $color-user-8: #faa774;
--color-composer-button: #{$color-text-secondary}CC;

--color-primary: #{$color-primary};
--color-primary-rgb: #{toRGB($color-primary)};
--color-primary-shade: #{mix($color-primary, $color-black, 92%)};
--color-primary-shade-darker: #{mix($color-primary, $color-black, 84%)};
--color-primary-shade-rgb: #{toRGB(mix($color-primary, $color-black, 92%))};
Expand Down
8 changes: 8 additions & 0 deletions src/util/switchTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ let isInitialized = false;
const HEX_COLOR_REGEX = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
const DURATION_MS = 200;
const ENABLE_ANIMATION_DELAY_MS = 500;
const RGB_VARIABLES = new Set([
'--color-primary-shade',
'--color-text-secondary',
]);

const lerp = (start: number, end: number, interpolationRatio: number) => {
return (1 - interpolationRatio) * start + interpolationRatio * end;
Expand Down Expand Up @@ -89,5 +93,9 @@ function applyColorAnimationStep(startIndex: number, endIndex: number, interpola
document.documentElement.style.setProperty(property, a !== undefined
? `rgba(${r},${g},${b},${a / 255})`
: `rgb(${r},${g},${b})`);

if (RGB_VARIABLES.has(property)) {
document.documentElement.style.setProperty(`${property}-rgb`, `${r},${g},${b}`);
}
});
}

0 comments on commit 1abb31e

Please sign in to comment.