@@ -245,6 +245,10 @@ const Self = class ColorSwatch extends ColorElement {
245245 from : true ,
246246 } ,
247247 } ,
248+ /**
249+ * Specified coords
250+ * @example ["oklch.h", "oklch.c", "oklch.l"]
251+ */
248252 infoCoords : {
249253 get ( ) {
250254 if ( ! this . info . length ) {
@@ -262,6 +266,7 @@ const Self = class ColorSwatch extends ColorElement {
262266 return ret ;
263267 } ,
264268 } ,
269+ // We need this to correctly work (calculate and show in the UI) with coords of type "angle"
265270 infoCoordsResolved : {
266271 get ( ) {
267272 if ( ! this . infoCoords ) {
@@ -282,7 +287,11 @@ const Self = class ColorSwatch extends ColorElement {
282287 return ret ;
283288 } ,
284289 } ,
285- infoOther : { // DeltaE, contrast, etc.
290+ /**
291+ * Specified deltaE and contrast
292+ * @example ["deltaE.2000", "contrast.WCAG21"]
293+ */
294+ infoOther : {
286295 get ( ) {
287296 if ( ! this . info . length ) {
288297 return ;
@@ -299,6 +308,10 @@ const Self = class ColorSwatch extends ColorElement {
299308 return ret ;
300309 } ,
301310 } ,
311+ /**
312+ * Coords for this.color
313+ * @example {"oklch.l": 0.7,"oklch.c": 0.25, "oklch.h": 138}
314+ */
302315 colorInfo : {
303316 get ( ) {
304317 if ( ! this . color || ! this . infoCoords ) {
@@ -318,12 +331,17 @@ const Self = class ColorSwatch extends ColorElement {
318331 return ret ;
319332 } ,
320333 } ,
334+ /**
335+ * Color deltas (between `this.color` and `this.vs`)
336+ * @example {"oklch.l": -0.3,"oklch.c": 0.35, "oklch.h": 108}
337+ */
321338 colorDeltas : {
322339 get ( ) {
323340 if ( ! this . infoCoordsResolved || ! this . vsInfo ) {
324341 return ;
325342 }
326343
344+ // TODO: Use Color.js deltas() instead (when v0.6.0 is released)
327345 let ret = { } ;
328346 for ( let coord of this . infoCoords ) {
329347 let value = this . colorInfo [ coord ] ;
@@ -348,11 +366,18 @@ const Self = class ColorSwatch extends ColorElement {
348366 return ret ;
349367 } ,
350368 } ,
369+ /**
370+ * Color to compare `this.color` with
371+ */
351372 vs : {
352373 get type ( ) {
353374 return Self . Color ;
354375 } ,
355376 } ,
377+ /**
378+ * Coords, deltaE, contrast for `this.vs`
379+ * @example {"oklch.l": 1, "oklch.c": 0, "oklch.h": null, "deltaE.2000": 37.69, "contrast.WCAG21": 2.46}
380+ */
356381 vsInfo : {
357382 get ( ) {
358383 if ( ! this . color || ! this . vs || ! this . info . length ) {
0 commit comments