Skip to content

Build your personal knowledge base with Trilium Notes

style/space usage: customize the colors of the browse view

Adorian Doran1dad6844574f
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
index e0ecc28e58..1c7364a01a 100644
--- a/apps/client/src/stylesheets/theme-next-dark.css
+++ b/apps/client/src/stylesheets/theme-next-dark.css
@@ -379,6 +379,25 @@
--space-usage-treemap-selected-saturation: 70%;
--space-usage-treemap-selected-lightness: 70%;
+
+ --space-usage-body-color: #a7c0d3;
+ --space-usage-attachments-color: #dec7a7;
+ --space-usage-revisions-color: #61d177;
+ --space-usage-revisions-stripe-color: #000000;
+
+ --space-usage-donut-track-color: var(--main-border-color);
+ --space-usage-donut-segment-color: var(--accented-background-color);
+ --space-usage-donut-segment-hover-color: var(--input-focus-outline-color);
+ --space-usage-donut-segment-selected-color: var(--main-text-color);
+
+ --space-usage-donut-segment-saturation: 55%;
+ --space-usage-donut-segment-lightness: 60%;
+
+ --space-usage-donut-hover-saturation: 90%;
+ --space-usage-donut-hover-lightness: 80%;
+
+ --space-usage-donut-selected-saturation: 90%;
+ --space-usage-donut-selected-lightness: 80%;
}
/*
diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
index ba364a583c..f04ce136fe 100644
--- a/apps/client/src/stylesheets/theme-next-light.css
+++ b/apps/client/src/stylesheets/theme-next-light.css
@@ -362,7 +362,7 @@
--task-checkbox-unknown-state-color: #e95d5d;
--task-checkbox-glyph-color: white;
- --space-usage-treemap-cell-background: var(--accented-background-color);
+ --space-usage-treemap-cell-background: var(--accented-background-color);
--space-usage-treemap-cell-icon-color: var(--muted-text-color);
--space-usage-treemap-cell-hover-color: var(--main-text-color);
--space-usage-treemap-cell-selected-color: var(--main-text-color);
@@ -379,6 +379,25 @@
--space-usage-treemap-selected-saturation: 35%;
--space-usage-treemap-selected-lightness: 50%;
+ --space-usage-body-color: #c5d6ef;
+ --space-usage-attachments-color: #f0d5b0;
+ --space-usage-revisions-color: #83de95;
+ --space-usage-revisions-stripe-color: #47be5f;
+
+ --space-usage-donut-track-color: var(--main-border-color);
+ --space-usage-donut-segment-color: var(--accented-background-color);
+ --space-usage-donut-segment-hover-color: var(--input-focus-outline-color);
+ --space-usage-donut-segment-selected-color: var(--main-text-color);
+
+ --space-usage-donut-segment-saturation: 63%;
+ --space-usage-donut-segment-lightness: 75%;
+
+ --space-usage-donut-hover-saturation: 57%;
+ --space-usage-donut-hover-lightness: 68%;
+
+ --space-usage-donut-selected-saturation: 35%;
+ --space-usage-donut-selected-lightness: 45%;
+
}
#left-pane .fancytree-node.tinted,
diff --git a/apps/client/src/widgets/react/charts/DonutChart.css b/apps/client/src/widgets/react/charts/DonutChart.css
index 7022ef36e8..2f8f924e36 100644
--- a/apps/client/src/widgets/react/charts/DonutChart.css
+++ b/apps/client/src/widgets/react/charts/DonutChart.css
@@ -1,3 +1,29 @@
+/* Zero specificity, so a theme overrides these from its own `:root` block and never has to outweigh
+ this stylesheet. A segment's hue is its own and comes in inline with the geometry; a theme sets
+ the saturation and lightness struck from it, one set per color scheme. */
+:where(:root) {
+ /* The band the segments are laid on, and a segment with neither a hue nor a semantic color of
+ its own. */
+ --space-usage-donut-track-color: var(--main-border-color);
+ --space-usage-donut-segment-color: var(--accented-background-color);
+ --space-usage-donut-segment-hover-color: var(--input-focus-outline-color);
+ --space-usage-donut-segment-selected-color: var(--main-text-color);
+
+ /* The segment's fill, matching the treemap's cells so the two charts speak one color
+ language. */
+ --space-usage-donut-segment-saturation: 50%;
+ --space-usage-donut-segment-lightness: 78%;
+
+ /* The hovered segment's ring: deep against the fill, and short of the chosen segment's full
+ strength so the two never read as the same state. */
+ --space-usage-donut-hover-saturation: 60%;
+ --space-usage-donut-hover-lightness: 35%;
+
+ /* The chosen segment's trace: the hue at full strength, standing well clear of the fill. */
+ --space-usage-donut-selected-saturation: 100%;
+ --space-usage-donut-selected-lightness: 50%;
+}
+
.donut-chart {
display: flex;
position: relative;
@@ -6,11 +32,6 @@
aspect-ratio: 1 / 1;
max-width: 100%;
- /* How a chosen segment's trace is struck from its own hue — see the rule below. Knobs for a
- theme, matching the treemap's, so the two charts mark a choice the same way. */
- --donut-selected-saturation: 100%;
- --donut-selected-lightness: 50%;
-
svg {
display: block;
width: 100%;
@@ -20,25 +41,26 @@
/* The empty band the segments are laid on, in the color of any other divider — a ring with
nothing on it still has to read as a ring rather than as a blank square. */
.donut-track {
- stroke: var(--donut-track-color, var(--main-border-color));
+ stroke: var(--space-usage-donut-track-color);
}
- /* Colored through a variable, not a competing rule: consumers set `--donut-segment-color` and
- never race this stylesheet's cascade position. */
+ /* Colored through a variable, not a competing rule: consumers set the segment's color and never
+ race this stylesheet's cascade position. */
.donut-segment {
- stroke: var(--donut-segment-color, var(--accented-background-color));
+ stroke: var(--space-usage-donut-segment-color);
/* Dash geometry is the segment's shape, so transitions carry re-layouts and the keyframe
sweeps a freshly mounted segment in from zero length. */
transition: stroke-dasharray 0.45s ease, stroke-dashoffset 0.45s ease;
animation: donut-sweep 0.45s ease;
}
- /* The same tint recipe as the treemap cells, so the two charts speak one color language. */
+ /* Struck on the segment itself, where the hue is: a custom property resolves `var()` against
+ the element it is declared on, so these cannot be composed up in the root block. */
.donut-segment.donut-colored {
- --donut-segment-color: color-mix(
- in srgb,
- var(--accented-background-color) 55%,
- hsl(var(--donut-hue) 65% 55%) 45%
+ --space-usage-donut-segment-color: hsl(
+ var(--donut-hue)
+ var(--space-usage-donut-segment-saturation)
+ var(--space-usage-donut-segment-lightness)
);
}
@@ -51,10 +73,18 @@
.donut-segment:hover {
filter:
brightness(1.12)
- drop-shadow(2px 0 0 var(--input-focus-outline-color))
- drop-shadow(-2px 0 0 var(--input-focus-outline-color))
- drop-shadow(0 2px 0 var(--input-focus-outline-color))
- drop-shadow(0 -2px 0 var(--input-focus-outline-color));
+ drop-shadow(2px 0 0 var(--space-usage-donut-segment-hover-color))
+ drop-shadow(-2px 0 0 var(--space-usage-donut-segment-hover-color))
+ drop-shadow(0 2px 0 var(--space-usage-donut-segment-hover-color))
+ drop-shadow(0 -2px 0 var(--space-usage-donut-segment-hover-color));
+ }
+
+ .donut-segment.donut-colored:hover {
+ --space-usage-donut-segment-hover-color: hsl(
+ var(--donut-hue)
+ var(--space-usage-donut-hover-saturation)
+ var(--space-usage-donut-hover-lightness)
+ );
}
}
@@ -64,18 +94,20 @@
itself with. */
.donut-segment.donut-segment-selected {
filter:
- drop-shadow(3px 0 0 var(--donut-segment-selected-color, var(--main-text-color)))
- drop-shadow(-3px 0 0 var(--donut-segment-selected-color, var(--main-text-color)))
- drop-shadow(0 3px 0 var(--donut-segment-selected-color, var(--main-text-color)))
- drop-shadow(0 -3px 0 var(--donut-segment-selected-color, var(--main-text-color)));
+ drop-shadow(3px 0 0 var(--space-usage-donut-segment-selected-color))
+ drop-shadow(-3px 0 0 var(--space-usage-donut-segment-selected-color))
+ drop-shadow(0 3px 0 var(--space-usage-donut-segment-selected-color))
+ drop-shadow(0 -3px 0 var(--space-usage-donut-segment-selected-color));
}
/* The segment's own hue at full strength, as the treemap strikes a chosen cell's border. A
segment painted from a semantic colour rather than a hue sets this variable itself; one with
neither keeps the plain default above. */
.donut-segment.donut-colored.donut-segment-selected {
- --donut-segment-selected-color: hsl(
- var(--donut-hue) var(--donut-selected-saturation) var(--donut-selected-lightness)
+ --space-usage-donut-segment-selected-color: hsl(
+ var(--donut-hue)
+ var(--space-usage-donut-selected-saturation)
+ var(--space-usage-donut-selected-lightness)
);
}
@@ -98,7 +130,6 @@
.donut-chart-center > * {
pointer-events: auto;
}
-
}
@keyframes donut-sweep {
diff --git a/apps/client/src/widgets/react/charts/DonutChart.tsx b/apps/client/src/widgets/react/charts/DonutChart.tsx
index 53afb469d2..dd3e39df81 100644
--- a/apps/client/src/widgets/react/charts/DonutChart.tsx
+++ b/apps/client/src/widgets/react/charts/DonutChart.tsx
@@ -55,7 +55,7 @@ interface DonutChartProps<T> {
selectedSegmentId?: string;
className?: string;
/**
- * SVG paint servers (gradients, patterns) for segments whose class points `--donut-segment-color`
+ * SVG paint servers (gradients, patterns) for segments whose class points `--space-usage-donut-segment-color`
* at one: a stroke can only reference them through `url(#id)`, so they must live in this chart's
* own `<defs>`.
*/
diff --git a/apps/client/src/widgets/type_widgets/space_usage/browse.css b/apps/client/src/widgets/type_widgets/space_usage/browse.css
index b15a2762bc..92067cb6bf 100644
--- a/apps/client/src/widgets/type_widgets/space_usage/browse.css
+++ b/apps/client/src/widgets/type_widgets/space_usage/browse.css
@@ -106,7 +106,7 @@
/* Not a note: nothing to navigate into, painted like the revisions it will one day free.
Repeats .donut-segment to outrank the primitive's clickable-cursor rule. */
.donut-segment.space-usage-segment-deleted {
- --donut-segment-color: var(--space-usage-revisions-color);
+ --space-usage-donut-segment-color: var(--space-usage-revisions-color);
cursor: default;
}
}
diff --git a/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.css b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.css
index 8193e8f67d..4831b51264 100644
--- a/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.css
+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.css
@@ -77,19 +77,19 @@
}
.cleanup-segment-deletedEntities {
- --donut-segment-color: var(--cleanup-deleted-color);
+ --space-usage-donut-segment-color: var(--cleanup-deleted-color);
}
.cleanup-segment-unusedAttachments {
- --donut-segment-color: var(--cleanup-attachments-color);
+ --space-usage-donut-segment-color: var(--cleanup-attachments-color);
}
.cleanup-segment-revisionSnapshots {
- --donut-segment-color: var(--cleanup-revisions-color);
+ --space-usage-donut-segment-color: var(--cleanup-revisions-color);
}
.cleanup-segment-compactDatabase {
- --donut-segment-color: var(--cleanup-compact-color);
+ --space-usage-donut-segment-color: var(--cleanup-compact-color);
}
/* Left in place rather than removed: the ring stands for everything reclaimable, so an unpicked
diff --git a/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.css b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.css
index 315d74b7a8..2c14dc8e6e 100644
--- a/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.css
+++ b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.css
@@ -1,33 +1,60 @@
-.note-usage-donut {
- /* The semantic segment colors; themes can override the variables. Mixed into the theme surface
- at a lower share than the children ring's tints (45%), so the composition ring reads
- deliberately quieter than the ring around it. */
- --space-usage-body-color: color-mix(in srgb, var(--accented-background-color) 70%, #5b8dd9 30%);
- --space-usage-attachments-color: color-mix(in srgb, var(--accented-background-color) 70%, #d9a93d 30%);
- --space-usage-revisions-color: color-mix(in srgb, var(--accented-background-color) 70%, #8f959c 30%);
- /* The hatch's stripes: the same gray carried further from the surface, so the texture reads at
- ring thickness without becoming a second color. */
- --space-usage-revisions-stripe-color: color-mix(in srgb, var(--accented-background-color) 40%, #8f959c 60%);
+/* The semantic segment colors, and the trace a chosen one is marked with. Zero specificity, so a
+ theme overrides them from its own `:root` block; the values here are the light scheme. */
+:where(:root) {
+ /* What the note itself holds, and what hangs off it. */
+ --space-usage-body-color: #c7d6ed;
+ --space-usage-attachments-color: #eddebe;
+ /* History, quieter than either: a tier rather than a thing the user put there. */
+ --space-usage-revisions-color: #d6d8da;
+ /* The hatch's stripes: the same gray carried further from the fill, so the texture reads
+ at ring thickness without becoming a second color. */
+ --space-usage-revisions-stripe-color: #b8bbc0;
+
+ /* The hue each fill is built on, so a hovered or chosen segment is marked the way a hue-colored
+ one is: struck from that hue at the strength the primitive gives. The revisions gray
+ stands for a tier rather than a thing and has no hue to give, so it keeps the plain
+ defaults. */
+ --space-usage-body-hue: 217;
+ --space-usage-attachments-hue: 42;
+ --space-usage-body-hover-color: hsl(
+ var(--space-usage-body-hue)
+ var(--space-usage-donut-hover-saturation)
+ var(--space-usage-donut-hover-lightness)
+ );
+ --space-usage-body-selected-color: hsl(
+ var(--space-usage-body-hue)
+ var(--space-usage-donut-selected-saturation)
+ var(--space-usage-donut-selected-lightness)
+ );
+ --space-usage-attachments-hover-color: hsl(
+ var(--space-usage-attachments-hue)
+ var(--space-usage-donut-hover-saturation)
+ var(--space-usage-donut-hover-lightness)
+ );
+ --space-usage-attachments-selected-color: hsl(
+ var(--space-usage-attachments-hue)
+ var(--space-usage-donut-selected-saturation)
+ var(--space-usage-donut-selected-lightness)
+ );
+}
- /* These two are painted from a semantic colour rather than from a hue, so they name the hue that
- colour is built on for the chosen trace to be struck from: the fills above are that hue mixed
- most of the way into the theme's surface, and this is the same hue at full strength. The
- revisions gray stands for a tier rather than a thing and has no hue to give, so its trace
- keeps the primitive's plain default. */
+.note-usage-donut {
.space-usage-segment-body {
- --donut-segment-color: var(--space-usage-body-color);
- --donut-segment-selected-color: hsl(217 100% 50%);
+ --space-usage-donut-segment-color: var(--space-usage-body-color);
+ --space-usage-donut-segment-hover-color: var(--space-usage-body-hover-color);
+ --space-usage-donut-segment-selected-color: var(--space-usage-body-selected-color);
}
.space-usage-segment-attachment {
- --donut-segment-color: var(--space-usage-attachments-color);
- --donut-segment-selected-color: hsl(42 100% 50%);
+ --space-usage-donut-segment-color: var(--space-usage-attachments-color);
+ --space-usage-donut-segment-hover-color: var(--space-usage-attachments-hover-color);
+ --space-usage-donut-segment-selected-color: var(--space-usage-attachments-selected-color);
}
/* Stroked with the hatch rather than a flat fill: history is not content the user put there,
and the texture says so without spending another color. */
.space-usage-segment-revisions {
- --donut-segment-color: url(#space-usage-revisions-hatch);
+ --space-usage-donut-segment-color: url(#space-usage-revisions-hatch);
}
.space-usage-hatch-base {
@@ -83,5 +110,4 @@
.note-usage-donut-size-value {
font-weight: 600;
}
-
}