@@ -1115,46 +1115,28 @@ function setting(p5, fn){
1115
1115
* @example
1116
1116
* <div>
1117
1117
* <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
+ *
1124
1122
* function setup() {
1125
- * createCanvas(300, 200 );
1123
+ * createCanvas(100, 100 );
1126
1124
* noStroke();
1127
1125
* noLoop();
1128
1126
* }
1129
- *
1127
+ *
1130
1128
* function draw() {
1131
- * //--- Left rectangle: RGB mode
1129
+ * // Set color mode to RGB with range 0-255
1132
1130
* 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
1154
1138
* textSize(14);
1155
1139
* text("RGB (128)", 10, 20);
1156
- * text("LAB (50)", 105, 20);
1157
- * text("HWB (50)", 205, 20);
1158
1140
* }
1159
1141
* </code>
1160
1142
* </div>
0 commit comments