Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ export class Color {
return `rgba(${c},${this.a})`;
}

/** Get the brightness of this color. */
/** Gets the brightness of this color.
* docs: https://www.w3.org/WAI/WCAG22/Techniques/general/G145
*/
get brightness() {
return (this.r * 299 + this.g * 587 + this.g * 114) / 1000;
return (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
}

/** Converts this color to an HSL array. */
Expand Down
Loading