Skip to content

Build your personal knowledge base with Trilium Notes

fix(ckeditor): tint the snippet icon like a real note icon

Elian Doran55b976ae56b1
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
index e0c2bfbb17..f97a89a4b5 100644
--- a/apps/client/src/stylesheets/theme-next-dark.css
+++ b/apps/client/src/stylesheets/theme-next-dark.css
@@ -417,7 +417,8 @@ body .todo-list input[type="checkbox"]:not(:checked):before {
.note-split.with-hue,
.quick-edit-dialog-wrapper.with-hue,
.nested-note-list-item.with-hue,
-.note-book-card.with-hue .note-book-header {
+.note-book-card.with-hue .note-book-header,
+.ck-template-icon.with-hue {
--note-icon-custom-background-color: hsl(var(--custom-color-hue), 15.8%, 30.9%);
--note-icon-custom-color: hsl(var(--custom-color-hue), 100%, 76.5%);
--note-icon-hover-custom-background-color: hsl(var(--custom-color-hue), 28.3%, 36.7%);
diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
index 89fcfb80b9..d7df29c5ee 100644
--- a/apps/client/src/stylesheets/theme-next-light.css
+++ b/apps/client/src/stylesheets/theme-next-light.css
@@ -389,7 +389,8 @@
.note-split.with-hue,
.quick-edit-dialog-wrapper.with-hue,
.nested-note-list-item.with-hue,
-.note-book-card.with-hue .note-book-header {
+.note-book-card.with-hue .note-book-header,
+.ck-template-icon.with-hue {
--note-icon-custom-background-color: hsl(var(--custom-color-hue), 44.5%, 43.1%);
--note-icon-custom-color: hsl(var(--custom-color-hue), 91.3%, 91%);
--note-icon-hover-custom-background-color: hsl(var(--custom-color-hue), 55.1%, 50.2%);
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index efccb44cb7..9b281c835b 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -433,10 +433,12 @@ div.ck-template-form .ck-labeled-field-view {
clobbering the glyph's `content`. */
:root div.ck-template-form .ck-template-icon {
position: relative;
- /* Honour the note's `#color` (carried by the `use-note-color` class, which defines
- `--custom-color`), falling back to the default icon colour when the note has none — the same
- mechanism the note tree uses for its icons. */
- color: var(--custom-color, var(--note-icon-color));
+ /* Render like a real note icon (cf. the list/grid view's `.note-icon`): a hue-light glyph on a
+ hue-tinted circular backdrop when the note has a `#color`, falling back to the neutral icon
+ colours otherwise. The `--note-icon-custom-*` variables come from the `.with-hue` rule the
+ plugin opts into (see theme-next-{dark,light}.css); they derive from `--custom-color-hue`,
+ which the note's colour class carries. */
+ color: var(--note-icon-custom-color, var(--note-icon-color));
&::after {
display: block;
@@ -444,7 +446,7 @@ div.ck-template-form .ck-labeled-field-view {
position: absolute;
inset: 2px;
border-radius: 50%;
- background: var(--note-icon-hover-background-color);
+ background: var(--note-icon-custom-background-color, var(--note-icon-hover-background-color));
z-index: -1;
}
}