Compare commits

..

No commits in common. "c58c18d6884287c5dc548163597b6f91ae4cf075" and "1aad2d8c09a4318895368712adc5bd5983a14deb" have entirely different histories.

2 changed files with 9 additions and 9 deletions

View File

@ -24,10 +24,6 @@ See [screenshots](https://triliumnext.github.io/Docs/Wiki/screenshot-tour) for q
<a href="https://triliumnext.github.io/Docs/Wiki/screenshot-tour"><img src="./docs/app.png" alt="Trilium Screenshot" width="1000"></a>
## ⏬ Download
- [Latest release](https://github.com/TriliumNext/Trilium/releases/latest) stable version, recommended for most users.
- [Nightly build](https://github.com/TriliumNext/Trilium/releases/tag/nightly) unstable development version, updated daily with the latest features and fixes.
## 📚 Documentation
**Visit our comprehensive documentation at [docs.triliumnotes.org](https://docs.triliumnotes.org/)**

View File

@ -16,10 +16,14 @@ const darkThemeColorMinLightness = readCssVar(
).asNumber(50);
function createClassForColor(colorString: string | null) {
if (!colorString?.trim()) return "";
if (!colorString?.trim()) {
return "";
}
const color = parseColor(colorString);
if (!color) return "";
if (!color) {
return;
}
const className = `color-${color.hex().substring(1)}`;
@ -50,7 +54,7 @@ function parseColor(color: string) {
}
}
/**
/**
* 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.
* The adjustment is performed by limiting the colors lightness in the CIELAB color space,
@ -62,7 +66,7 @@ function adjustColorLightness(color: ColorInstance, lightThemeMaxLightness: numb
// For the light theme, limit the maximum lightness
const lightThemeColor = labColor.l(Math.min(lightness, lightThemeMaxLightness)).hex();
// For the dark theme, limit the minimum lightness
const darkThemeColor = labColor.l(Math.max(lightness, darkThemeMinLightness)).hex();
@ -82,4 +86,4 @@ function adjustColorLightness(color: ColorInstance, lightThemeMaxLightness: numb
export default {
createClassForColor
};
};