We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f328a41 commit f7a3470Copy full SHA for f7a3470
.changeset/rich-lamps-compare.md
@@ -0,0 +1,5 @@
1
+---
2
+"@gitbook/colors": patch
3
4
+
5
+Change lightness check for color step 9 to allow input colors with a higher-than-needed contrast
packages/colors/src/transformations.ts
@@ -214,7 +214,11 @@ export function colorScale(
214
const targetL =
215
foregroundColor.L * mapping[index] + backgroundColor.L * (1 - mapping[index]);
216
217
- if (index === 8 && !mix && Math.abs(baseColor.L - targetL) < 0.2) {
+ if (
218
+ index === 8 &&
219
+ !mix &&
220
+ (darkMode ? targetL - baseColor.L < 0.2 : baseColor.L - targetL < 0.2)
221
+ ) {
222
// Original colour is close enough to target, so let's use the original colour as step 9.
223
result.push(hex);
224
continue;
0 commit comments