fix random text color

This commit is contained in:
HF 2022-08-13 19:59:00 +02:00
parent d11afa83fd
commit fc86dcd967
5 changed files with 44 additions and 42 deletions

View File

@ -123,30 +123,6 @@ const Chat = ({
ref={targetRef}
className="chat-container"
>
<div
className="chatlink"
style={{
fontSize: btnSize,
}}
>
<span
onClick={(event) => {
const {
clientX,
clientY,
} = event;
dispatch(showContextMenu(
'CHANNEL',
clientX,
clientY,
{ cid: chatChannel },
));
}}
role="button"
title={t`Channel settings`}
tabIndex={-1}
></span>
</div>
<ul
className="chatarea"
ref={listRef}
@ -230,6 +206,30 @@ const Chat = ({
chatChannel={chatChannel}
/>
</form>
<div
className="chatlink"
style={{
fontSize: btnSize,
}}
>
<span
onClick={(event) => {
const {
clientX,
clientY,
} = event;
dispatch(showContextMenu(
'CHANNEL',
clientX,
clientY,
{ cid: chatChannel },
));
}}
role="button"
title={t`Channel settings`}
tabIndex={-1}
></span>
</div>
</div>
);
};

View File

@ -325,7 +325,7 @@ export function colorFromText(str) {
.toString(16)
.toUpperCase();
return `#${'00000'.substring(0, 6 - c.length)}${c}`;
return `#${`00000${c}`.slice(-6)}`;
}
/*
@ -346,7 +346,10 @@ export function setBrightness(hex, dark = false) {
g += 128;
b += 128;
}
return `#${r.toString(16)}${g.toString(16)}${b.toString(16)}`;
r = `0${r.toString(16)}`.slice(-2);
g = `0${g.toString(16)}`.slice(-2);
b = `0${b.toString(16)}`.slice(-2);
return `#${r}${g}${b}`;
}
/*

View File

@ -575,17 +575,6 @@ export function openWindow(
width = null,
height = null,
) {
/*
* default window size
*/
if (!fullscreen
&& (!xPos || !width || !yPos || !height)) {
width = 340;
height = 400;
xPos = window.innerWidth - width - 62;
yPos = window.innerHeight - height - 64;
}
return {
type: 'OPEN_WINDOW',
windowType,
@ -873,9 +862,18 @@ export function hideAllWindowTypes(
}
export function openChatWindow() {
const width = 350;
const height = 350;
return openWindow(
'CHAT',
'',
null,
false,
true,
window.innerWidth - width - 62,
window.innerHeight - height - 64,
width,
height,
);
}

View File

@ -26,14 +26,15 @@ function generateWindowId(state) {
* clamp size and position to screen borders and restrictions
*/
function clampSize(prefWidth, prefHeight, margin = false) {
const width = prefWidth || 550;
const height = prefHeight || 330;
let maxWidth = window.innerWidth;
let maxHeight = window.innerHeight;
if (margin) {
maxWidth = Math.floor(maxWidth * 0.75);
maxHeight = Math.floor(maxHeight * 0.75);
// same as modal in default.css
maxWidth = Math.floor(maxWidth * 0.70);
maxHeight = Math.floor(Math.min(maxHeight * 0.80, 900));
}
const width = prefWidth || maxWidth;
const height = prefHeight || maxHeight;
return [
clamp(
width,

View File

@ -643,7 +643,7 @@ tr:nth-child(even) {
max-height: none;
outline: none;
border: none;
border-radius: inherit;
border-radius: inherit !important;
}
.modal {