Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/CK editor forms: restyle the picker buttons of the color input fields

Adorian Doran350c3e0f863c
diff --git a/apps/client/src/stylesheets/theme-next/forms.css b/apps/client/src/stylesheets/theme-next/forms.css
index 24266fc516..d69677ed5e 100644
--- a/apps/client/src/stylesheets/theme-next/forms.css
+++ b/apps/client/src/stylesheets/theme-next/forms.css
@@ -126,7 +126,8 @@ input::selection,
/* Input groups */
-.input-group {
+.input-group,
+:root .ck.ck-input-color {
/* Named rather than written into the padding alone, so that a field drawing an indicator of its
own can place it against the group's edge — which is this much further out than the field's. */
--input-group-padding-inline-end: 8px;
@@ -140,11 +141,13 @@ input::selection,
flex-wrap: nowrap;
}
-.input-group:hover {
+.input-group:hover,
+:root .ck.ck-input-color:hover {
background: var(--input-hover-background);
}
-.input-group:focus-within {
+.input-group:focus-within,
+:root .ck.ck-input-color:focus-within {
outline: 3px solid var(--input-focus-outline-color);
outline-offset: 0;
background: var(--input-focus-background);
@@ -157,7 +160,8 @@ input::selection,
.input-group input:focus,
.input-group .form-control,
.input-group .form-control:hover,
-.input-group .form-control:focus {
+.input-group .form-control:focus,
+:root .ck.ck-input-color > input.ck.ck-input-text {
/* Ignore the focus outline for the inputs that are children of an input group */
outline: unset;
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index 8a8eaba598..c61042bdd6 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -652,6 +652,51 @@ button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel).ck
opacity: 1;
}
+/*
+ * Color inputs
+ */
+
+:root .ck.ck-input-color {
+ --input-group-padding-inline-end: 0;
+ --ck-input-color-preview-border-radius: 4px;
+}
+
+:root .ck.ck-input-color > .ck.ck-dropdown > button.ck.ck-input-color__button {
+ box-shadow: none;
+ border-color: transparent;
+ background: transparent;
+}
+
+:root .ck.ck-input-color__button__preview {
+ --ck-color-input-border: transparent;
+}
+
+:root .ck.ck-input-color__button:focus-visible > .ck-input-color__button__preview {
+ outline: 2px solid var(--input-focus-outline-color);
+ outline-offset: 2px;
+}
+
+/* No color, drawn as the reset cell of ColorPicker.css */
+:root .ck.ck-input-color__button__preview:not(:has(> .ck-hidden)) {
+ background: var(--note-color-picker-clear-color-cell-background);
+
+ &::after {
+ content: "\ec8d";
+ display: flex;
+ position: absolute;
+ inset: 0;
+ justify-content: center;
+ align-items: center;
+ font-family: boxicons;
+ font-size: 16px;
+ color: var(--note-color-picker-clear-color-cell-color);
+ }
+
+ > .ck-input-color__button__preview__no-color-indicator {
+ visibility: hidden;
+ }
+}
+
/*
* Button groups
*/