mirror of
https://github.com/zadam/trilium.git
synced 2025-11-30 04:24:24 +01:00
fix(quick-edit): background broke for colors with no hue
This commit is contained in:
parent
ec76b9dc5c
commit
88a7ebef69
@ -1,7 +1,9 @@
|
|||||||
|
import clsx from "clsx";
|
||||||
import {readCssVar} from "../utils/css-var";
|
import {readCssVar} from "../utils/css-var";
|
||||||
import Color, { ColorInstance } from "color";
|
import Color, { ColorInstance } from "color";
|
||||||
|
|
||||||
const registeredClasses = new Set<string>();
|
const registeredClasses = new Set<string>();
|
||||||
|
const colorsWithHue = new Set<string>();
|
||||||
|
|
||||||
// Read the color lightness limits defined in the theme as CSS variables
|
// Read the color lightness limits defined in the theme as CSS variables
|
||||||
|
|
||||||
@ -26,19 +28,23 @@ function createClassForColor(colorString: string | null) {
|
|||||||
if (!registeredClasses.has(className)) {
|
if (!registeredClasses.has(className)) {
|
||||||
const adjustedColor = adjustColorLightness(color, lightThemeColorMaxLightness!,
|
const adjustedColor = adjustColorLightness(color, lightThemeColorMaxLightness!,
|
||||||
darkThemeColorMinLightness!);
|
darkThemeColorMinLightness!);
|
||||||
|
const hue = getHue(color);
|
||||||
|
|
||||||
$("head").append(`<style>
|
$("head").append(`<style>
|
||||||
.${className}, span.fancytree-active.${className} {
|
.${className}, span.fancytree-active.${className} {
|
||||||
--light-theme-custom-color: ${adjustedColor.lightThemeColor};
|
--light-theme-custom-color: ${adjustedColor.lightThemeColor};
|
||||||
--dark-theme-custom-color: ${adjustedColor.darkThemeColor};
|
--dark-theme-custom-color: ${adjustedColor.darkThemeColor};
|
||||||
--custom-color-hue: ${getHue(color) ?? 'unset'};
|
--custom-color-hue: ${hue ?? 'unset'};
|
||||||
}
|
}
|
||||||
</style>`);
|
</style>`);
|
||||||
|
|
||||||
registeredClasses.add(className);
|
registeredClasses.add(className);
|
||||||
|
if (hue) {
|
||||||
|
colorsWithHue.add(className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `color ${className}`;
|
return clsx(className, colorsWithHue.has(className) && "with-hue");
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseColor(color: string) {
|
function parseColor(color: string) {
|
||||||
|
|||||||
@ -301,7 +301,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {
|
|||||||
border-color: var(--muted-text-color) !important;
|
border-color: var(--muted-text-color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-edit-dialog-wrapper.color {
|
.quick-edit-dialog-wrapper.with-hue {
|
||||||
--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);
|
--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);
|
||||||
--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);
|
--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);
|
||||||
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);
|
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);
|
||||||
|
|||||||
@ -276,7 +276,7 @@
|
|||||||
--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);
|
--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-edit-dialog-wrapper.color {
|
.quick-edit-dialog-wrapper.with-hue {
|
||||||
--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);
|
--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);
|
||||||
--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);
|
--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);
|
||||||
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 40%, 88%);
|
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 40%, 88%);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user