Skip to content

Commit

Permalink
Clarify implementation in jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Dec 11, 2024
1 parent fd1898a commit 7f05d39
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Playroom/palettes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,30 @@ const guard = (amount: number) => {
};

/**
* Implementation of `transparentize` from polished but using native CSS
* Subtracts `amount` from the alpha channel of `color`.
* Amount must be between 0 and 1 inclusive.
*
* Similar to `transparentize` from polished but uses CSS
* @see https://polished.js.org/docs/#transparentize
*/
const transparentize = (amount: number, color: string) =>
`rgb(from ${color} r g b / calc(alpha - ${guard(amount)}))`;

/**
* Implementation of `darken` from polished but using native CSS
* Subtracts `amount` from the lightness of `color`.
* Amount must be between 0 and 1 inclusive.
*
* Similar to `darken` from polished but uses CSS
* @see https://polished.js.org/docs/#darken
*/
const darken = (amount: number, color: string) =>
`hsl(from ${color} h s calc(l - ${guard(amount) * 100}))`;

/**
* Implementation of `mix` from polished but using native CSS
* Mixes `amount` of `color1` into `color2`.
* Amount must be between 0 and 1 inclusive.
*
* Similar to `mix` from polished but uses CSS
* @see https://polished.js.org/docs/#mix
*/
const mix = (amount: number, color1: string, color2: string) =>
Expand Down

0 comments on commit 7f05d39

Please sign in to comment.