Skip to content

Commit

Permalink
Fix docstrings to conform to typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
privet-kitty committed Jan 27, 2024
1 parent 72c2cc3 commit e90d9ae
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 160 deletions.
8 changes: 4 additions & 4 deletions src/arithmetic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const polarToCartesian = (r: number, theta: number, perimeter = TWO_PI):
* @param x - must be in the counterclockwise interval [min, max]
* @param theta1
* @param theta2
* @param [perimeter = TWO_PI]
* @param [perimeter]
*/
export const circularNearer = (
x: number,
Expand All @@ -68,7 +68,7 @@ export const circularNearer = (
* @param x
* @param min
* @param max
* @param [perimeter = TWO_PI]
* @param [perimeter]
*/
export const circularClamp = (x: number, min: number, max: number, perimeter = TWO_PI): number => {
const xMod = mod(x, perimeter);
Expand Down Expand Up @@ -100,7 +100,7 @@ export const circularClamp = (x: number, min: number, max: number, perimeter = T
* @param coef - should be in [0, 1]
* @param theta1
* @param theta2
* @param [perimeter = TWO_PI]
* @param [perimeter]
*/
export const circularLerp = (
coef: number,
Expand All @@ -117,7 +117,7 @@ export const circularLerp = (
* Δ satisfies theta2 + Δ ≡ theta1 and -perimeter/2 <= Δ <= perimeter/2.
* @param theta1
* @param theta2
* @param [perimter = TWO_PI]
* @param [perimter]
*/
export const circularDelta = (theta1: number, theta2: number, perimeter = TWO_PI): number => {
const d = mod(theta1 - theta2, perimeter);
Expand Down
2 changes: 1 addition & 1 deletion src/colorspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Illuminant {
}
}

// The following data are based on dufy. Bradford transformation is used as CAT.
// The following data are based on dufy. I use the Bradford transformation as CAT.
export const ILLUMINANT_D65 = new Illuminant(
0.950428061568676,
1.08891545904089,
Expand Down
42 changes: 23 additions & 19 deletions src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
/**
* Converts Munsell value to Y (of XYZ) based on the formula in the ASTM
* D1535-18e1.
* @param value - will be in [0, 10]. Clamped if it exceeds the
* @param v - will be in [0, 10]. Clamped if it exceeds the
* interval.
* @returns {number} Y
*/
Expand Down Expand Up @@ -203,7 +203,8 @@ const mhvcToLchabGeneralCase = (

/**
* Converts Munsell HVC to LCHab. Note that the returned value is under
* <strong>Illuminant C</strong>.
* **Illuminant C**. I don't recommend you use this function
* if you are not sure what that means.
* @param hue100 - is in the circle group R/100Z. Any real number is
* accepted.
* @param value - will be in [0, 10]. Clamped if it exceeds the
Expand Down Expand Up @@ -254,7 +255,8 @@ export const munsellToMhvc = (munsellStr: string): Vector3 => {

/**
* Converts Munsell Color string to LCHab. Note that the returned value is under
* <strong>Illuminant C</strong>.
* **Illuminant C**. I don't recommend you use this function
* if you are not sure what that means.
* @param munsellStr - is the standard Munsell Color code.
* @returns {Array} [L*, C*ab, hab]
*/
Expand All @@ -264,7 +266,8 @@ export const munsellToLchab = (munsellStr: string): Vector3 => {

/**
* Converts Munsell HVC to CIELAB. Note that the returned value is under
* <strong>Illuminant C</strong>.
* **Illuminant C**. I don't recommend you use this function
* if you are not sure what that means.
* @param hue100 - is in the circle group R/100Z. Any real number is
* accepted.
* @param value - will be in [0, 10]. Clamped if it exceeds the
Expand All @@ -279,7 +282,8 @@ export const mhvcToLab = (hue100: number, value: number, chroma: number): Vector

/**
* Converts Munsell Color string to CIELAB. Note that the returned value is under
* <strong>Illuminant C</strong>.
* **Illuminant C**. I don't recommend you use this function
* if you are not sure what that means.
* @param munsellStr
* @returns {Array} [L*, a*, b*]
*/
Expand All @@ -295,7 +299,7 @@ export const munsellToLab = (munsellStr: string): Vector3 => {
* interval.
* @param chroma - will be in [0, +inf). Assumed to be zero if it is
* negative.
* @param [illuminant = ILLUMINANT_D65]
* @param [illuminant]
* @returns {Array} [X, Y, Z]
*/
export const mhvcToXyz = (
Expand All @@ -314,7 +318,7 @@ export const mhvcToXyz = (
/**
* Converts Munsell Color string to XYZ.
* @param munsellStr
* @param [illuminant = ILLUMINANT_D65]
* @param [illuminant]
* @returns {Array} [X, Y, Z]
*/
export const munsellToXyz = (munsellStr: string, illuminant = ILLUMINANT_D65): Vector3 => {
Expand All @@ -329,7 +333,7 @@ export const munsellToXyz = (munsellStr: string, illuminant = ILLUMINANT_D65): V
* the interval.
* @param chroma - will be in [0, +inf). Assumed to be zero
* if it is negative.
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [linear R, linear G, linear B]
*/
export const mhvcToLinearRgb = (
Expand All @@ -344,7 +348,7 @@ export const mhvcToLinearRgb = (
/**
* Converts Munsell Color string to linear RGB.
* @param munsellStr
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [linear R, linear G, linear B]
*/
export const munsellToLinearRgb = (munsellStr: string, rgbSpace = SRGB): Vector3 => {
Expand All @@ -359,7 +363,7 @@ export const munsellToLinearRgb = (munsellStr: string, rgbSpace = SRGB): Vector3
* interval.
* @param chroma - will be in [0, +inf). Assumed to be zero if it is
* negative.
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [R, G, B]
*/
export const mhvcToRgb = (
Expand All @@ -374,7 +378,7 @@ export const mhvcToRgb = (
/**
* Converts Munsell Color string to gamma-corrected RGB.
* @param munsellStr
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [R, G, B]
*/
export const munsellToRgb = (munsellStr: string, rgbSpace = SRGB): Vector3 => {
Expand All @@ -389,9 +393,9 @@ export const munsellToRgb = (munsellStr: string, rgbSpace = SRGB): Vector3 => {
* interval.
* @param chroma - will be in [0, +inf). Assumed to be zero if it is
* negative.
* @param [clamp = true] - If true, the returned value will be clamped
* @param [clamp] - If true, the returned value will be clamped
* to the range [0, 255].
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [R255, G255, B255]
*/
export const mhvcToRgb255 = (
Expand All @@ -407,9 +411,9 @@ export const mhvcToRgb255 = (
/**
* Converts Munsell Color string to quantized RGB.
* @param munsellStr
* @param [clamp = true] - If true, the returned value will be clamped
* @param [clamp] - If true, the returned value will be clamped
* to the range [0, 255].
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {Array} [R255, G255, B255]
*/
export const munsellToRgb255 = (munsellStr: string, clamp = true, rgbSpace = SRGB): Vector3 => {
Expand All @@ -424,7 +428,7 @@ export const munsellToRgb255 = (munsellStr: string, clamp = true, rgbSpace = SRG
* interval.
* @param chroma - will be in [0, +inf). Assumed to be zero if it is
* negative.
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {string} hex color "#XXXXXX"
*/
export const mhvcToHex = (
Expand All @@ -439,20 +443,20 @@ export const mhvcToHex = (
/**
* Converts Munsell Color string to 24-bit hex color.
* @param munsellStr
* @param [rgbSpace = SRGB]
* @param [rgbSpace]
* @returns {string} hex color "#XXXXXX"
*/
export const munsellToHex = (munsellStr: string, rgbSpace = SRGB): string => {
return mhvcToHex(...munsellToMhvc(munsellStr), rgbSpace);
};

/**
* Converts Munsell HVC to string. `N', the code for achromatic colors, is used
* Converts Munsell HVC to string. `N`, the code for achromatic colors, is used
* when the chroma becomes zero w.r.t. the specified number of digits.
* @param hue100
* @param value
* @param chroma
* @param [digits = 1] - is the number of digits after the decimal
* @param [digits] - is the number of digits after the decimal
* point. Must be non-negative integer. Note that the units digit of the hue
* prefix is assumed to be already after the decimal point.
* @returns {string} Munsell Color code
Expand Down
20 changes: 10 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* <code>mhvc</code>, or Munsell HVC, is a 3-number expression of Munsell
* Color composed of [Hue, Value, Chroma]: e.g. <code>[94.2, 3.5, 11]</code>,
* <code>[0, 10 ,0]</code>. Here Hue is in the circle group R/100Z: i.e. 0R (=
* 10RP) corresponds to 0 (= 100 = 300 = -2000) and 2YR corresponds to 12 (= -88
* ## Data structure for Munsell Color
* `mhvc`, or Munsell HVC, is a 3-number expression of Munsell
* Color composed of [Hue, Value, Chroma]: e.g. `[94.2, 3.5, 11]` or
* `[0, 10 ,0]`. Hue is in the circle group R/100Z, e.g. the value of 0R (=
* 10RP) is 0 (= 100 = 300 = -2000) and that of 2YR is 12 (= -88
* = 412). Value is in the interval [0, 10] and the converters will clamp it if
* a given value exceeds it. Chroma is non-negative and the converters will
* assume it to be zero if a given chroma is negative. Note that every converter
* accepts a huge chroma outside the Munsell Renotation Data (e.g. 1000000) and
* returns a extrapolated result.
*
* <code>munsell</code> is the standard string specification of the
* Munsell Color: e.g. <code>"4.2RP 3.5/11"</code>, <code>"N 10"</code>. Here
* various notations of numbers are accepted; an ugly specification like
* <code>"2e-02RP .9/0xf"</code> (equivalent to <code>"0.02RP 0.9/15"</code>)
* will be also available. However, the capital letters A-Z and the slash '/'
* are reserved.
* `munsell` is the standard string specification of the Munsell Color:
* e.g. `"4.2RP 3.5/11"` or `"N 10"`. Here various notations of numbers are
* accepted. An ugly specification like `"2e-02RP .9/0xf"` (equivalent to
* `"0.02RP 0.9/15"`) will be also available. However, the capital letters
* A-Z and the slash '/' are reserved.
* @module
*/
export * from './convert';
Expand Down
Loading

0 comments on commit e90d9ae

Please sign in to comment.