mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 03:59:05 +01:00
chore(client): fix typecheck
This commit is contained in:
parent
1aad2d8c09
commit
e04bd36dfe
@ -16,14 +16,10 @@ const darkThemeColorMinLightness = readCssVar(
|
|||||||
).asNumber(50);
|
).asNumber(50);
|
||||||
|
|
||||||
function createClassForColor(colorString: string | null) {
|
function createClassForColor(colorString: string | null) {
|
||||||
if (!colorString?.trim()) {
|
if (!colorString?.trim()) return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const color = parseColor(colorString);
|
const color = parseColor(colorString);
|
||||||
if (!color) {
|
if (!color) return "";
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const className = `color-${color.hex().substring(1)}`;
|
const className = `color-${color.hex().substring(1)}`;
|
||||||
|
|
||||||
@ -54,7 +50,7 @@ function parseColor(color: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pair of colors — one optimized for light themes and the other for dark themes, derived
|
* Returns a pair of colors — one optimized for light themes and the other for dark themes, derived
|
||||||
* from the specified color to maintain sufficient contrast with each theme.
|
* from the specified color to maintain sufficient contrast with each theme.
|
||||||
* The adjustment is performed by limiting the color’s lightness in the CIELAB color space,
|
* The adjustment is performed by limiting the color’s lightness in the CIELAB color space,
|
||||||
@ -66,7 +62,7 @@ function adjustColorLightness(color: ColorInstance, lightThemeMaxLightness: numb
|
|||||||
|
|
||||||
// For the light theme, limit the maximum lightness
|
// For the light theme, limit the maximum lightness
|
||||||
const lightThemeColor = labColor.l(Math.min(lightness, lightThemeMaxLightness)).hex();
|
const lightThemeColor = labColor.l(Math.min(lightness, lightThemeMaxLightness)).hex();
|
||||||
|
|
||||||
// For the dark theme, limit the minimum lightness
|
// For the dark theme, limit the minimum lightness
|
||||||
const darkThemeColor = labColor.l(Math.max(lightness, darkThemeMinLightness)).hex();
|
const darkThemeColor = labColor.l(Math.max(lightness, darkThemeMinLightness)).hex();
|
||||||
|
|
||||||
@ -86,4 +82,4 @@ function adjustColorLightness(color: ColorInstance, lightThemeMaxLightness: numb
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
createClassForColor
|
createClassForColor
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user