@@ -1115,46 +1115,28 @@ function setting(p5, fn){
11151115 * @example
11161116 * <div>
11171117 * <code>
1118- *
1119- * // Example: Single-value (Grayscale) colors in different color modes.
1120- * // Each rectangle is filled with one parameter, but its final color depends
1121- * // on how that parameter is interpreted by the current color mode.
1122- *
1123- *
1118+ * // Example: Single-value (Grayscale) colors in different color modes.
1119+ * // The rectangle is filled with one parameter, but its final color depends
1120+ * // on how that parameter is interpreted by the current color mode.
1121+ *
11241122 * function setup() {
1125- * createCanvas(300, 200 );
1123+ * createCanvas(100, 100 );
11261124 * noStroke();
11271125 * noLoop();
11281126 * }
1129- *
1127+ *
11301128 * function draw() {
1131- * //--- Left rectangle: RGB mode
1129+ * // Set color mode to RGB with range 0-255
11321130 * colorMode(RGB, 255);
1133- * fill(128); // Interpreted as R=G=B=128 in RGB
1134- * rect(0, 0, 100, 200);
1135- *
1136- * //--- Middle rectangle: LAB mode
1137- * // In LAB, a single value is interpreted as Lightness (L).
1138- * // The default max for each LAB component is 100, so a single value of 50
1139- * // becomes roughly halfway in terms of lightness.
1140- * colorMode(LAB, 100);
1141- * fill(50);
1142- * rect(100, 0, 100, 200);
1143- *
1144- * //--- Right rectangle: HWB mode
1145- * // In HWB, a single value is mapped onto whiteness and blackness together.
1146- * // Because both W and B are needed to specify a gray, the library averages
1147- * // their max values to interpret this single parameter.
1148- * colorMode(HWB, 100);
1149- * fill(50);
1150- * rect(200, 0, 100, 200);
1151- *
1152- * // Add text labels
1153- * fill(0); // Switch to black text for clarity (RGB mode for text)
1131+ *
1132+ * // Fill with single grayscale value
1133+ * fill(128);
1134+ * rect(0, 0, 100, 100);
1135+ *
1136+ * // Add text label
1137+ * fill(0); // Switch to black text for clarity
11541138 * textSize(14);
11551139 * text("RGB (128)", 10, 20);
1156- * text("LAB (50)", 105, 20);
1157- * text("HWB (50)", 205, 20);
11581140 * }
11591141 * </code>
11601142 * </div>
0 commit comments