Skip to content

Commit

Permalink
feat: Add isMonochrome() method (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Lasaj authored Dec 5, 2022
1 parent 7b46026 commit f659dce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ export class TinyColor {
return this;
}

/**
* Returns whether the color is monochrome.
*/
isMonochrome(): boolean {
const { s } = this.toHsl();
return s === 0;
}

/**
* Returns the object as a HSVA object.
*/
Expand Down

0 comments on commit f659dce

Please sign in to comment.