aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-17 13:04:26 -0500
committerbobzel <zzzman@gmail.com>2023-11-17 13:04:26 -0500
commit96d27379d77b77f7496a1b2c5f30824cc04370c0 (patch)
tree42a2ff40bacdeef89791d974aa1d19fc9708c9b3
parentf027832dd2e3267b70e94c1e60d1703ff86d7fe2 (diff)
from last
-rw-r--r--src/Utils.ts7
-rw-r--r--src/client/views/nodes/DocumentView.scss5
-rw-r--r--src/client/views/nodes/DocumentView.tsx2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 9499aaf2f..4e4414a93 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -754,12 +754,9 @@ export function DashColor(color: string) {
}
export function lightOrDark(color: any) {
- if (color === 'transparent' || !color) return Colors.DARK_GRAY;
+ if (color === 'transparent' || !color) return Colors.BLACK;
if (color.startsWith?.('linear')) return Colors.BLACK;
- const nonAlphaColor = color.startsWith('#') ? (color as string).substring(0, 7) : color.startsWith('rgba') ? color.replace(/,.[^,]*\)/, ')').replace('rgba', 'rgb') : color;
- const col = DashColor(nonAlphaColor).rgb();
- const colsum = col.red() + col.green() + col.blue();
- if (colsum / col.alpha() > 400 || col.alpha() < 0.25) return Colors.DARK_GRAY;
+ if (DashColor(color).isLight()) return Colors.BLACK;
return Colors.WHITE;
}
diff --git a/src/client/views/nodes/DocumentView.scss b/src/client/views/nodes/DocumentView.scss
index 3344dfae4..505e937c5 100644
--- a/src/client/views/nodes/DocumentView.scss
+++ b/src/client/views/nodes/DocumentView.scss
@@ -187,12 +187,15 @@
top: 0;
width: 100%;
height: 14;
- background: rgba(0, 0, 0, 0.4);
+ opacity: 0.5;
text-align: center;
text-overflow: ellipsis;
white-space: pre;
position: absolute;
display: flex; // this allows title field dropdown to be inline with editable title
+ &:hover {
+ opacity: 1;
+ }
}
.documentView-titleWrapper-hover {
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index c577a9e3c..d1caf0acf 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1164,7 +1164,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
const targetDoc = showTitle?.startsWith('_') ? this.layoutDoc : this.rootDoc;
const background = StrCast(
this.layoutDoc.layout_headingColor,
- StrCast(SharingManager.Instance.users.find(u => u.user.email === this.dataDoc.author)?.sharingDoc.headingColor, StrCast(this.layoutDoc.layout_headingColor, StrCast(Doc.SharingDoc().headingColor, SettingsManager.userBackgroundColor)))
+ StrCast(SharingManager.Instance.users.find(u => u.user.email === this.dataDoc.author)?.sharingDoc.headingColor, StrCast(Doc.SharingDoc().headingColor, SettingsManager.userBackgroundColor))
);
const dropdownWidth = this._titleRef.current?._editing || this._changingTitleField ? Math.max(10, (this._dropDownInnerWidth * this.titleHeight) / 30) : 0;
const sidebarWidthPercent = +StrCast(this.layoutDoc.layout_sidebarWidthPercent).replace('%', '');