Skip to content

Build your personal knowledge base with Trilium Notes

style/text editor/custom task states: add hover feedback for checkboxes

Adorian Doranf25577ce6865
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
index 3cdae700da..f3e85b9c12 100644
--- a/apps/client/src/stylesheets/theme-next-dark.css
+++ b/apps/client/src/stylesheets/theme-next-dark.css
@@ -327,9 +327,12 @@
--calendar-coll-today-background-color: #ffffff08;
--task-checkbox-without-state-background: #ffffff26;
+ --task-checkbox-without-state-hover-background: #ffffff59;
--task-checkbox-with-state-background: #ffffff3b;
+ --task-checkbox-with-state-hover-background: var(--task-checkbox-with-state-hover-background);
--task-checkbox-done-color: #408b40;
- --task-checkbox-unknown-state-color: orange;
+ --task-checkbox-done-hover-color: #41b441;
+ --task-checkbox-unknown-state-color: #e95d5d;
--task-checkbox-glyph-color: white;
}
@@ -413,4 +416,8 @@ body .todo-list input[type="checkbox"]:not(:checked):before {
[data-trilium-task-state] {
--task-state-adjusted-color: hsl(var(--task-state-hue), 40%, 50%);
+}
+
+:where(.ck-content .todo-list li[data-trilium-task-state]), .tn-task-checkbox {
+ --task-state-custom-hover-background-color: hsl(var(--task-state-hue), 50%, 60%);
}
\ No newline at end of file
diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
index 35d13a9e7e..ff1652fc3c 100644
--- a/apps/client/src/stylesheets/theme-next-light.css
+++ b/apps/client/src/stylesheets/theme-next-light.css
@@ -325,11 +325,15 @@
--callendar-coll-event-archived-sripe-color: #0000000a;
--calendar-coll-today-background-color: #00000006;
- --task-checkbox-without-state-background: #d5d5d5;
+ --task-checkbox-without-state-background: #00000029;
+ --task-checkbox-without-state-hover-background: #0000004a;
--task-checkbox-with-state-background: gray;
+ --task-checkbox-with-state-hover-background: #000000a2;
--task-checkbox-done-color: green;
- --task-checkbox-unknown-state-color: orange;
+ --task-checkbox-done-hover-color: #41b441;
+ --task-checkbox-unknown-state-color: #e95d5d;
--task-checkbox-glyph-color: white;
+
}
#left-pane .fancytree-node.tinted,
@@ -385,4 +389,8 @@
[data-trilium-task-state] {
--task-state-adjusted-color: hsl(var(--task-state-hue), 50%, 50%);
+}
+
+:where(.ck-content .todo-list li[data-trilium-task-state]), .tn-task-checkbox {
+ --task-state-custom-hover-background-color: hsl(var(--task-state-hue), 50%, 60%);
}
\ No newline at end of file
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index 424b44550d..5c7ed3b3fa 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -586,6 +586,44 @@ button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel).ck
border-bottom: none;
}
+/*
+ * Multistate checkboxes
+ */
+
+/* Prevent variables from bleeding into nested items */
+.ck-content.ck-editor__editable .todo-list .todo-list {
+ --_task-checkbox-hover-background-color: initial;
+}
+
+/* Checkboxes with a task state */
+.ck-content .todo-list li[data-trilium-task-state]:not([data-trilium-task-state="none"]) {
+ --_task-checkbox-hover-background-color: var(--task-state-custom-hover-background-color, var(--task-checkbox-with-state-hover-background));
+}
+
+/* Checkboxes in the "done" state */
+.ck-content.ck-editor__editable .todo-list li:where(:not([data-trilium-task-state]), [data-trilium-task-state="done"]):has(> .todo-list__label input[type="checkbox"]:checked) {
+ --_task-checkbox-hover-background-color: var(--task-checkbox-done-hover-color);
+}
+
+/* All checkboxes */
+:root .ck-content.ck-editor__editable ul.todo-list li .todo-list__label input[type="checkbox"] {
+ background: transparent;
+
+ &:hover::before {
+ box-shadow: 0 0 0 5px color-mix(in srgb, var(--_task-checkbox-background, var(--task-checkbox-without-state-hover-background)) 25%, transparent);
+ background: var(--_task-checkbox-hover-background-color, var(--task-checkbox-without-state-hover-background));
+ }
+}
+
+/* Unknown task state */
+:root .ck-content.ck-editor__editable ul.todo-list li.tn-unknown-task-state .todo-list__label input[type="checkbox"] {
+ outline: none;
+
+ &:before {
+ outline: 2px solid var(--task-checkbox-unknown-state-outline-color);
+ }
+}
+
/*
* EDITOR'S CONTENT
*/