Skip to content

Commit

Permalink
also complements okay
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Feb 26, 2024
1 parent 9ffaf02 commit 74f8990
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/lib/lints/muth-guidelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,34 @@ const AvoidTooMuchContrastWithTheBackground: CustomLint = {
};
lints.push(AvoidTooMuchContrastWithTheBackground);

// use pairs of colors
// this isnt a muth its just sort of implied
const requireColorComplements: CustomLint = {
name: `Require color complements`,
program: JSONToPrettyString({
// @ts-ignore
$schema: `${location.href}lint-schema.json`,
exist: {
in: "colors",
varbs: ["a", "b"],
predicate: {
similar: {
left: { "hsl.h": "a" },
right: { "+": { left: { "hsl.h": "b" }, right: 180 } },
threshold: 5,
},
},
},
}),
taskTypes: ["sequential", "diverging", "categorical"] as const,
affectTypes: [],
level: "warning",
group: "design",
description: `Use color complements whenever possible`,
failMessage: `This palette has colors that do not have good contrast.`,
id: `require-color-complements-built-in`,
blameMode: "pair",
};
lints.push(requireColorComplements);

export default lints;

0 comments on commit 74f8990

Please sign in to comment.