Skip to content

Commit

Permalink
chore: add basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Oct 20, 2022
1 parent 3033721 commit 657455e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apis/theme/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ export default function theme() {

return styleResolverInstanceCache[basePath].getStyle(path, attribute);
},

/**
* Validates a color string using d3-color.
* See https://www.npmjs.com/package/d3-color
* @param {string} specifier
* @returns {string|undefined} The resolved color or undefined
* @ignore
*
* @example
* theme.validateColor("red"); // returns "rgba(255,0,0,1)"
* theme.validateColor("#00ff00"); // returns "rgba(0,255,0,1)"
* theme.validateColor("FOO"); // returns undefined
*/
validateColor(...args) {
const c = d3color(...args);
return c ? c.toString() : undefined;
Expand Down

0 comments on commit 657455e

Please sign in to comment.